Issue Details (XML | Word | Printable)

Key: MDL-18273
Type: Bug Bug
Status: Closed Closed
Resolution: Not a bug
Priority: Minor Minor
Assignee: Jerome Mouneyrac
Reporter: Ian Robotham
Votes: 1
Watchers: 5
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Custom Authentication Plugins do not get their language strings in User add/editing screens

Created: 16/Feb/09 11:52 PM   Updated: 03/Nov/09 10:37 PM
Return to search
Component/s: Authentication
Affects Version/s: 1.9.4
Fix Version/s: 1.9.6

File Attachments: 1. Text File MDL-18273 Auth Plugin Language Strings.patch (0.9 kB)
2. Text File MDL-18273.patch (4 kB)

Environment:
Dev: Win XP, XAMPP 1.6.7, PHP 5.2.6
Test: Ubuntu, PHP 5.2.6
Prod: Linux, PHP 5.2.5
Issue Links:
Relates
 

Participants: Darko Miletic, Eloy Lafuente (stronk7), Ian Robotham, Jerome Mouneyrac, Martin Dougiamas and Petr Skoda
Security Level: None
Resolved date: 03/Nov/09
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
In user add & editing, the language strings for custom authentication plugins are not searched for correctly.

See http://moodle.org/mod/forum/discuss.php?d=116543

Will create patch and attach in a while...

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Ian Robotham added a comment - 17/Feb/09 12:54 AM
Patch for this issue, tested on both our local development & our test servers. Both running Moodle 1.9.4

Ian Robotham made changes - 17/Feb/09 12:54 AM
Field Original Value New Value
Attachment MDL-18273 Auth Plugin Language Strings.patch [ 16296 ]
Petr Skoda made changes - 17/Feb/09 12:57 AM
Fix Version/s 1.9.5 [ 10320 ]
Eloy Lafuente (stronk7) added a comment - 17/Feb/09 03:46 AM
Uhm... it seems that there are a bunch of places doing the search only against 'auth' lang file.

1) Instead of the suggested patch (that only fixes one place) I would do:

  • Move the logic of auth_plugin_base->get_title() to standalone function auth_get_title() somewhere in datalib or similar.
  • Make auth_plugin_base->get_title() to use the new standalone function
  • Make all occurrences of "auth.*title" in moodle core to use the standalone function.

2) Or alternatively:

  • Leave auth_plugin_base->get_title() unmodified.
  • Instantiate auth plugin and use its get_title() method in all occurrences of moodle core

3) Or, also:

  • Leave auth_plugin_base->get_title() unmodified.
  • Create standalone function auth_get_title() somewhere in datalib or similar.
  • Make all occurrences of "auth.*title" in moodle core to use the standalone function.
    (causes logic to be duplicated)

My +1 for 1) above.

Assigning to Jerome, please await Petr's confirmation before doing anything here. TIA!

Ciao


Eloy Lafuente (stronk7) made changes - 17/Feb/09 03:46 AM
Assignee Petr ?koda [ skodak ] Jerome Mouneyrac [ jerome ]
Petr Skoda added a comment - 04/May/09 04:00 PM
I do not like this kind of custom string handling in general.
I think that in 2.0 there should be a lang file for each plugin including the core plugins

For now I would just hack - base->get_title() to make it search the separate files too
and in 2.0 rewrite the string handling there completely

I personally hate having to instantiate object just to get the title - we do that in blocks for everything and it is a nightmare


Petr Skoda made changes - 06/May/09 05:19 PM
Fix Version/s 1.9.5 [ 10320 ]
Fix Version/s 1.9.6 [ 10340 ]
Jerome Mouneyrac added a comment - 11/May/09 12:05 PM
Hi Petr,
auth_plugin_base->get_title() already search for separate files, I think you mean that we should use the Eloy 1) suggestion? If no, tell me. I'll fix it this avo following Eloy 1) suggestion.

For information: the bug appears in three different places, and the code is well written in two other places.


Jerome Mouneyrac made changes - 11/May/09 12:06 PM
Status Open [ 1 ] In Progress [ 3 ]
Jerome Mouneyrac added a comment - 12/May/09 02:23 PM
I attached a patch I will commit tomorrow after the build

Jerome Mouneyrac made changes - 12/May/09 02:23 PM
Attachment MDL-18273.patch [ 17260 ]
Jerome Mouneyrac committed 6 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 13/May/09 01:35 PM
authentication MDL-18273 Custom Authentication Plugin title can be retrieved from specific language file
MODIFY user/filters/lib.php   Rev. 1.1.2.5    (+2 -2 lines)
MODIFY admin/uploaduser.php   Rev. 1.68.2.15    (+2 -2 lines)
MODIFY user/editadvanced_form.php   Rev. 1.14.2.12    (+2 -2 lines)
MODIFY lib/weblib.php   Rev. 1.970.2.137    (+14 -2 lines)
MODIFY admin/settings/users.php   Rev. 1.26.2.17    (+2 -5 lines)
MODIFY lib/authlib.php   Rev. 1.8.2.7    (+2 -6 lines)
Martin Dougiamas added a comment - 13/May/09 03:10 PM
This accidentally got into the 1.9.5 build, but it looks OK.

What exactly are we doing for this in HEAD?


Martin Dougiamas made changes - 13/May/09 03:10 PM
Fix Version/s 1.9.5 [ 10320 ]
Fix Version/s 1.9.6 [ 10340 ]
Petr Skoda added a comment - 13/May/09 03:33 PM
in HEAD we should split auth.php lang file into multiple files separate for each plugin and use standard get_string() support.

Jerome Mouneyrac added a comment - 13/May/09 03:43 PM
I'll commit the current change into HEAD and write a new issue for splitting the auth language file.

Martin Dougiamas added a comment - 14/May/09 10:57 AM
Resolving this then ... Jerome, can you link to the new issue when you make it?

Martin Dougiamas made changes - 14/May/09 10:57 AM
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Jerome Mouneyrac added a comment - 14/May/09 01:16 PM
sorry I didn't commit in HEAD yet. I do this now, and create a new issue for 2.0.

Jerome Mouneyrac made changes - 14/May/09 01:16 PM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Jerome Mouneyrac committed 6 files to 'Moodle CVS' - 14/May/09 03:03 PM
authentication MDL-18273 Custom Authentication Plugin title can be retrieved from specific language file, merged from 19
MODIFY admin/uploaduser.php   Rev. 1.93    (+2 -2 lines)
MODIFY admin/settings/users.php   Rev. 1.49    (+2 -5 lines)
MODIFY lib/authlib.php   Rev. 1.23    (+2 -6 lines)
MODIFY user/filters/lib.php   Rev. 1.15    (+2 -2 lines)
MODIFY lib/weblib.php   Rev. 1.1252    (+15 -2 lines)
MODIFY user/editadvanced_form.php   Rev. 1.28    (+2 -2 lines)
Jerome Mouneyrac added a comment - 14/May/09 03:05 PM
Ok fixed on Head too.

Jerome Mouneyrac made changes - 14/May/09 03:05 PM
Status Reopened [ 4 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Jerome Mouneyrac made changes - 14/May/09 03:14 PM
Link This issue has a non-specific relationship to MDL-19182 [ MDL-19182 ]
Darko Miletic added a comment - 31/Oct/09 09:40 PM
I see this same issue back in Moodle 1.9.6+

What I did was following:
1. Made a stub for new auth plugin
2. Created supposed language files (<MOODLE>/auth/newplugin/lang/en_utf8/auth_newplugin.php)
3. Added strings:
$string['auth_newplugintitle' ] = 'New title';
$string['auth_newplugdescription'] = 'New description';

And it does not work. The only place where string was picked up was plugin title in the admin block (once the plugin was enabled).

In all other places I saw [[auth_title]] and [[auth_description]] instead of [[auth_newplugintitle]] and [[auth_newplugindescription]].


Darko Miletic made changes - 31/Oct/09 09:40 PM
Resolution Fixed [ 1 ]
Status Closed [ 6 ] Reopened [ 4 ]
Fix Version/s 1.9.6 [ 10340 ]
Fix Version/s 1.9.5 [ 10320 ]
Darko Miletic added a comment - 03/Nov/09 10:31 PM
This was my mistake sorry. Not a bug.

Darko Miletic made changes - 03/Nov/09 10:31 PM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Not a bug [ 7 ]
Darko Miletic made changes - 03/Nov/09 10:32 PM
Status Resolved [ 5 ] Closed [ 6 ]
Jerome Mouneyrac added a comment - 03/Nov/09 10:37 PM
No problem Darko