Forum LAMS for Tech-Heads - General Forum: Re: locale of users from moodle integration


 
Search: 

2: Re: locale of users from moodle integration
In response to 1 02/10/08 04:40 PM
[ Reply | Forward ]
Hi Glen,

The users in LAMS will be created with the same locale as these users have in Moodle. So if your Moodle user has a default locale German (for instance), then when created in LAMS, her default locale will be German as well.

> Is there anyway around this other than logging in to lams as sysadmin and resetting each users locale?

You can do this directly in the database, login directly into the mysql database and run:

UPDATE lams_user SET locale_id = 3 ;

The locale_id 3 is the one for Maori (mi_NZ).

That will fix all users that are *already* created in LAMS (note: if you want only certain users you might want to apply some WHERE conditions to the sql statement)

For all new users, since LAMS picks up the locale and language they use in Moodle, you can change the Moodle users to have Maori? Then, LAMS will create those users with default language as Maori.

If this last one is not an option, you can hack the userinfo.php file in the lamstwo Moodle module so it returns to LAMS a hard coded locale. Just modify this line:

$array = array('',$user->firstname,$user->lastname,$user->address,$user->city,'','',$user->country,$user->phone1,'','',$user->email,$user->country,substr($user->lang,0,2));

to

$array = array('',$user->firstname,$user->lastname,$user->address,$user->city,'','',$user->country,$user->phone1,'','',$user->email,NZ,mi);


And I think that should do it

Posted by Ernie Ghiglione

3: Re: Re: locale of users from moodle integration
In response to 2 02/11/08 02:22 AM
[ Reply | Forward ]
Hi Ernie
Thanks for your reply. I have tried both things you suggested, setting moodle user language to Maori, and also editing the userinfo.php file to pass through mi, and in both cases when the lams user is created it still gets the default english language. Can you suggest any ways to debug the problem here?
Thanks
Regards
Glen

Posted by Glen Davies

4: Re: Re: Re: locale of users from moodle integration
In response to 3 02/11/08 02:23 PM
[ Reply | Forward ]
Hi Glen,

> I have tried both things you suggested, setting moodle user language to Maori, and also editing the userinfo.php file to
> pass through mi, and in both cases when the lams user is created it still gets the default english language.

When a Moodle user gets to a LAMS lesson, the first thing LAMS does is to check whether the user does also exist in LAMS. If it doesn't, then LAMS calls the userinfo.php in Moodle to get info about the user. This userinfo request will return the basic user information so LAMS can generate the user. For the language, LAMS will use the country and language code to set the default language for this particular user.

Now if you change the default user language in Moodle *after* it was already created in LAMS, then in LAMS this user will still have the original language that he/she was created with. If you want to change existing users, you might need to run the sql script I mentioned before.

Yesterday I tried this creating a user from scratch in the Moodle demo site and it seems to work fine.

You can give it a go by creating a user there with country as New Zeland and then in the user's profile change the name to Maori, and you will see than after that, whenever you access LAMS, the LAMS interface will be Maori.

BTW, are you using LAMS 2.0.4, right?

Thanks,

Ernie

Posted by Ernie Ghiglione

5: Re: Re: Re: Re: locale of users from moodle integration
In response to 4 02/11/08 05:45 PM
[ Reply | Forward ]
Thanks again. This is one of those frustrating issues - should just work, but isn't ...

I went to the test server you mention and yes it all works as stated, but when I create a brand new users on our moodle server and set the country to NZ and language to Maori, and then add a new lams activity with that user it gets the default language of English Australian on LAMS. I have also tried with existing users by deleting their lams user account and then adding another lams sequence in moodle, and again the new account it creates is English.

The only difference I can spot in our installation is the moodle language pack is mi_wwwow and on your server it is mi_tn, but userinfo.php only sends through the mi part of the langauge pack string anyway.

Yes we are on LAMS 2.0.4 and Moodle 1.8.3

Any other ideas?

Thanks
Regards
Glen

Posted by Glen Davies

Reply to first post on this page
Back to LAMS for Tech-Heads - General Forum