auth:userinfo_debugging
This is an old revision of the document!
I used the following hack to display the complete information on the user currently logged in. This will be displayed instead of the 'Logged in as:' field at the bottom-left of the page.
This proved very useful to me for debugging LDAP/AD group membership problems.
I modified the function tpl_userinfo() in inc/template.php
.
The hack
Original:
function tpl_userinfo(){ global $lang; global $INFO; if($_SERVER['REMOTE_USER']){ print $lang['loggedinas'].': '.$INFO['userinfo']['name']; return true; } return false; }
With extra debugging information:
function tpl_userinfo(){ global $lang; global $INFO; if($_SERVER['REMOTE_USER']){ print 'Debug:<br><font size=2><pre>'.print_r($INFO['userinfo'],true).'</pre></font>'; return true; } return false; }
The nicer way
A nicer way of doing this is checking for a custom option userinfo_debug
, which can now be set in conf/local.php
:
function tpl_userinfo(){ global $lang; global $INFO; global $conf; if($_SERVER['REMOTE_USER']){ if($conf['userinfo_debug'] == 'true') { print 'Debug:<br><font size=2><pre>'.print_r($INFO['userinfo'],true).'</pre></font>'; } else { print $lang['loggedinas'].': '.$INFO['userinfo']['name']; } return true; } return false; }
Now to turn on debugging, set the following in conf/local.php
:
$conf['userinfo_debug'] = 'true';
To switch off debugging, set the following in conf/local.php
:
$conf['userinfo_debug'] = 'false';
auth/userinfo_debugging.1420307008.txt.gz · Last modified: 2015-01-03 18:43 by 37.200.79.27