H HIPHOP.GAME Member Feb 20, 2025 #1 I'm creating a blank .php and I would like to know the current user's id & name. I used the addon that was created but it doesn't give me this info. Thanks
I'm creating a blank .php and I would like to know the current user's id & name. I used the addon that was created but it doesn't give me this info. Thanks
Sim Well-known member Feb 20, 2025 #2 PHP: $visitor = \XF::visitor(); $userId = $visitor->user_id; $username = $visitor->username; Of course, this needs to be run in the context of the XF application - a blank .php file will not do it, needs to bootstrap the framework first.
PHP: $visitor = \XF::visitor(); $userId = $visitor->user_id; $username = $visitor->username; Of course, this needs to be run in the context of the XF application - a blank .php file will not do it, needs to bootstrap the framework first.