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
Next revision
Previous revision
auth:userinfo_debugging [2015-01-03 18:43] 37.200.79.27auth: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; 
-  global $INFO; 
-  if($_SERVER['REMOTE_USER']){ 
-    print $lang['loggedinas'].': '.$INFO['userinfo']['name']; 
-    return true; 
-  } 
-  return false; 
-} 
-</code> 
- 
-With extra debugging information: 
-<code php> 
-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; 
-} 
-</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 $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; 
-} 
-</code> 
-Now to turn on debugging, set the following in ''conf/local.php'': 
-<code php> 
-$conf['userinfo_debug'] = 'true'; 
-</code> 
-To switch off debugging, set the following in ''conf/local.php'': 
-<code php> 
-$conf['userinfo_debug'] = 'false'; 
-</code> 
  
auth/userinfo_debugging.1420307008.txt.gz · Last modified: 2015-01-03 18:43 by 37.200.79.27

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