× R0.30 Support

Strange characters

9 years 8 months ago
Emanuel
Posts: 6
More
Topic Author
Strange characters #1
In our Moodle installation, we've noticed that if a username contains accented chararacters or cedillas (ç), then when adding the user to moodle, a second user is created with a negative ID, this user is registered in both joomdle and moodle but not in joomla, the original user only is registered in joomla. Also the user details (from the new user) in moodle are empty.

ID Username
901 Ailó
-502 ailã³

Any toughts on how to correct this.

We already have modified our registration form, so that it doesn't accept those chars, but we already have a large number of users in this situation.

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Antonio Durán
Posts: 7129
More
Strange characters #2
I can confirm the problem, testing in my local enviroment.

I will try to come with a fix and let you know.

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Antonio Durán
Posts: 7129
More
Strange characters #3
Hi again.

I have been looking into this, and it seems I found a solution.
We won't include it for R0.4, as we are ready to ship now, and have not time to double test that this does not have any adverse effects.

You can do the modifications by yourself if you want, and then comment if it solves your problem and/or if you find any other issues.

Changes are minimal. Just add this line:
$username = utf8_decode ($username);
In 3 places:
- Joomdle xmlrpc plugin in joomla (plugins/xmlrpc/joomdle.php). At the start of functions get_user_info and confirm_joomla_session.
- Joomdle auth plugin (moodle/auth/joomdle/auth.php). At the start of create_joomdle_user function.

Once this is more tested, we will include it for a future release.

Please test and comment.

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Emanuel
Posts: 6
More
Topic Author
Strange characters #4
That solution works, but only partially. The strange characters are gone, but a second new user with a negative ID is still created. This new user has all the data from the old user.
Attachments:

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Antonio Durán
Posts: 7129
More
Strange characters #5
Hi.

Are you sure he wasn't there from earlier tests?

In my tests, I don't get the other user created.

Are you sure you changed the 3 places I told you?

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Emanuel
Posts: 6
More
Topic Author
Strange characters #6
Quite sure, as I deleted all negative ID users.
Here is what changed in both joomla and moodle.

moodle/auth/joomdle/auth.php
function create_joomdle_user ($username)
{
        global $CFG;
	$username = utf8_decode ($username);
	$username = addslashes ($username);
...
plugins/xmlrpc/joomdle.php
function confirmJoomlaSession($username, $token)
{
$username = utf8_decode ($username);
...
function getUserInfo($username)
{
$username = utf8_decode ($username);
...

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Antonio Durán
Posts: 7129
More
Strange characters #7
It seems this one is another error, that happens because of capital letters in username. It does not happens with only-lower usernames.

Will test more and let you know.

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Antonio Durán
Posts: 7129
More
Strange characters #8
Hi again.

I re-tested, and it seems users are not being double-created.

What happens is that you would need utf8_decode code to other places too, so that joomdle users list shows ok.

Also, for it to really work for users, changes should be made along much more joomdle code, as every call that uses the username as a param will fail.

If you want, I can prepare and pack a new package with changes applied everywhere, so you can more asily re-install and test.
This will time some time though, as I need to revise almost all joomdle code.

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Emanuel
Posts: 6
More
Topic Author
Strange characters #9
Our main issue were the characters and that issue (thanks to you) is solved. At the moment we can live with the double users issue, so there's no need for you to create a new package. We can wait until a new version of joomdle that has this issue solved.

Thanks for the outstanding support.

Please Log in or Create an account to join the conversation.

9 years 8 months ago
Antonio Durán
Posts: 7129
More
Strange characters #10
You are welcome, thanks for your input.

Bear in mind that nothing will work in Joomdle for users with utf8 chars in username (my courses, enrolling, etc), so this was more a proof of concept test, than a solution.

Please Log in or Create an account to join the conversation.