Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
How to get name of currently logged in user?
Avatar
og #1
Member since May 2006 · 437 posts · Location: Bayern
Group memberships: Members
Show profile · Link to this post
Subject: How to get name of currently logged in user?
What is the preferred way to get the currently logged in user inside my code?
a)
$userid = $INPUT->server->str('REMOTE_USER');
b)
if (isset($INFO['user'])) $userid = $INFO['user'];
Oli...
Avatar
og #2
Member since May 2006 · 437 posts · Location: Bayern
Group memberships: Members
Show profile · Link to this post
It seems that $INFO['user'] is empty after a pagesave. Maybe it's a bug, maybe expected behaviour. So the best solution is to use the REMOTE_USER (which comes from the webserver).
Oli...
Avatar
turnermm (Moderator) #3
Member since Oct 2009 · 4785 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
In reply to post #1
$userid = $INPUT->server->str('REMOTE_USER');

This is set by Dokuwiki and overrides the web serrver's setting: https://www.dokuwiki.org/devel:environm…?s[]=remote_user…
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
og #4
Member since May 2006 · 437 posts · Location: Bayern
Group memberships: Members
Show profile · Link to this post
Thanks for pointing this out, Turner!
Oli...
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-02-26, 14:55:10 (UTC +01:00)