We have various custom (in-house developed) authentication plugins and have our language files in /auth/<plugin>/lang/en_utf8/auth_<plugin>.php These work fine on the manage authentication plugins admin page and on the menu, however they don't work on the User adding/editing pages - it shows the default unresolved auth_<plugin>title string.
After a bit of looking in to one of the pages (user/editadvanced_form.php), the strings are obtained by:
$modules = get_list_of_plugins('auth');
$auth_options = array();
foreach ($modules as $module) {
$auth_options[$module] = get_string("auth_$module"."title", "auth");
}
So I did some digging into the get_string() method, and came across this:
5323 if (!in_array($module, $exceptions)) { 5324 $dividerpos = strpos($module, '_'); 5325 if ($dividerpos === false) {Now since we are passing in "auth", line 5325 will evaluate to true, meaning we are going to be looking for our language strings in $CFG->dirroot . "/$location/auth/lang/ and looking at places_to_search_for_lang_strings(), passing in '' means it looks in mod.
5326 $type = '';
5327 $plugin = $module; 5328 } else { 5329 $type = substr($module, 0, $dividerpos + 1); 5330 $plugin = substr($module, $dividerpos + 1); 5331 } 5332 if (!empty($rules[$type])) { 5333 foreach ($rules[$type] as $location) { 5334 $locations[] = $CFG->dirroot . "/$location/$plugin/lang/"; 5335 } 5336 } 5337 }
So I tried this out, by putting our language strings in /mod/auth/lang/en_utf8/auth.php and this works fine - the strings appear ok.
Is this really the intended behaviour or is it (as I suspect) a bug? If it is a bug, which is the best/preferred way to fix this - is it to:
- add an additional test to get_string() to check for "auth" coming in and redirecting it to the appropriate file.
- change the places where it's getting the string, to use whatever method is used by the manage auth plugins page (if so can somebody point me to where this is - I'm a bit confused with the $page =& $adminroot->locate($section); and where the actual files for this are!)
- Some other way - suggestions please!
Thanks in advance,
Ian