DokuWiki

It's better when it's simple

User Tools

Site Tools


auth:userinfo_debugging

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
auth:userinfo_debugging [2018-07-25 23:13] – Update to conform with code base 2018-07-25 Aaron Smithauth:userinfo_debugging [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-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: 
-<code php> 
-function tpl_userinfo() { 
-    global $lang; 
-    /** @var Input $INPUT */ 
-    global $INPUT; 
- 
-    if($INPUT->server->str('REMOTE_USER')) { 
-        print $lang['loggedinas'].' '.userlink(); 
-        return true; 
-    } 
-    return false; 
-} 
- 
-</code> 
- 
-With extra debugging information: 
-<code php> 
-function tpl_userinfo() { 
-    global $lang; 
-    /** @var Input $INPUT */ 
-    global $INPUT; 
- 
-    if($INPUT->server->str('REMOTE_USER')) { 
-        print $lang['loggedinas'].' '.userlink(); 
-        msg('Debug user info:'.print_r($USERINFO, true), -1); 
-        return true; 
-    } 
-    return false; 
-} 
-</code> 
- 
-===== 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'': 
- 
-<code php> 
-function tpl_userinfo() { 
-    global $conf; 
-    global $lang; 
-    global $USERINFO; 
-    /** @var Input $INPUT */ 
-    global $INPUT; 
-  
-    if($INPUT->server->str('REMOTE_USER')) { 
-        print $lang['loggedinas'].' '.userlink(); 
-        if($conf['userinfo_debug'] == 1) msg('Debug user info:'.print_r($USERINFO, true), -1); 
-        return true; 
-    } 
-    return false; 
-} 
-</code> 
-Now to turn on debugging, set the following in ''conf/local.php'': 
-<code php> 
-$conf['userinfo_debug'] = 1; 
-</code> 
-To switch off debugging, set the following in ''conf/local.php'': 
-<code php> 
-$conf['userinfo_debug'] = 0; 
-</code> 
  
auth/userinfo_debugging.1532553190.txt.gz · Last modified: 2018-07-25 23:13 by Aaron Smith

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki