View Full Version : How to grab logged user
I'm writing a small component, but I need to to grab the username of the logged-in user because the component will personalize his the output by giving that username..
I try to use the var $uid, but it doesn't work.. I try to read the official faq over mamboserver but it says that I'm not authorized to do it...
Thanks!
Drake
keliix06
10.04.2004, 20:06
The $my variable stores all user info. $my->username is the username. You can find more info for this by looking at the login module, as well as classes/mambo.php
It works! thanks a lot!
Good Easter @ all
The $my variable stores all user info. $my->username is the username. You can find more info for this by looking at the login module, as well as classes/mambo.php
I performed a var_dump($my) but not all data is stored in $my !!
The result:
object(mosuser)(15) {
["id"]=>
int(62)
["name"]=>
NULL
["username"]=>
string(5) "admin"
["email"]=>
NULL
["password"]=>
NULL
["usertype"]=>
string(19) "Super Administrator"
["block"]=>
NULL
["sendEmail"]=>
NULL
["gid"]=>
int(2)
["registerDate"]=>
NULL
["lastvisitDate"]=>
NULL
["_tbl"]=>
string(8) "#__users"
["_tbl_key"]=>
string(2) "id"
["_error"]=>
string(0) ""
["_db"]=>
object(database)(6) {
["_sql"]=>
string(0) ""
["_errorNum"]=>
int(0)
["_errorMsg"]=>
string(0) ""
["_table_prefix"]=>
string(4) "mos_"
["_resource"]=>
resource(1) of type (mysql link)
["_cursor"]=>
NULL
}
}
So where to find the name of the user?
vBulletin® v3.8.0, Copyright ©2000-2013, Jelsoft Enterprises Ltd.