Error message on my system affected function _autologout_check_one_session on row 544.
There is a behaviour about submitting page:
admin/config/people/autologout
My site has english as default language and italian as second one. If I access module's configuration panel from italian lang:
it/admin/config/people/autologout
variable autologout_one_session is registered in database this way:
a:4:{s:18:"utente autenticato";s:1:"0";s:13:"administrator";s:1:"0";s:9:"role2";s:1:"0";s:11:"role3";s:1:"0";}
But if I access module's configuration panel from english lang:
en/admin/config/people/autologout
variable autologout_one_session is registered in database this way:
a:4:{s:18:"authenticated user";s:1:"0";s:13:"administrator";s:1:"0";s:9:"role2";s:1:"0";s:11:"role3";s:1:"0";}
In file autologout.module row 543-545 I see:
foreach ($user->roles as $role) {
$return = $return && $values[t($role)];
}
t() function translates user's role and this creates problems when variables contains role name translated in a language different from language selected by user.
MY TEMPORARY SOLUTION:
I had to access module's configuration panel from english lang and then submit, then I change module's code omitting translation function t() this way:
foreach ($user->roles as $role) {
$return = $return && $values[$role];
}
But I think this a bug: module should always save autologout_one_session variable in english and omit t() function inside the code.
What do you think about?
Anyway this is a great module, thank you.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | autologout-translated_role_names-1835374-5.patch | 2.28 KB | rudiedirkx |
| #4 | autologout-translated_role_names-1835374-4.patch | 1.88 KB | rudiedirkx |
| #2 | 1835374-role_name_workaround.patch | 517 bytes | nevergone |
| #1 | 1835374-role_name_workaround.patch | 1 KB | nevergone |
Comments
Comment #1
nevergoneSmall workaround with 7.x-2.x.
Comment #2
nevergoneAnother patch, remove unnecessary changes.
Comment #3
joris_luciusIf you do not have access to the code or the translation of the role does not matter, you can also remove the translation of the role.
Still this patch has to be done (not tested)
Comment #4
rudiedirkx commentedThe problem isn't that roles are NOT translated. The problem is that roles ARE translated. We don't translate machine names. Ever.
user_roles()unfortunately doesn't return machine names =(My patch fixes this, but might not be backward compatible in all cases. (It'll forever use actual, untranslated machine names and the existing variables might contain translated machine names.) It's rolled against the current stable (7.x-2.0-beta1) so it might not apply to dev.
Comment #5
rudiedirkx commentedActually that's not good enough. Somewhere else
t()is explicitly called for$role. New patch attached that includes that fix. Rolled against 7.x-2.0-beta1.Comment #6
johnennew commentedI don't believe this is an issue on the 4.x branch - I suggest testing the update path to the recent 7.x-4.1. 2.x branches are no longer supported. Feel free to reopen if you feel this is still an issue in 4.x