Knowledge Base

List of $userdata variables
Article ID: 104
Written By: battye
Written On: Thu Aug 30, 2007 11:43 am
Description: A list of all of the columns you can use in a $userdata variable.
link to this article on phpbb.com: Select All
[kb=list-of-userdata-variables]List of $userdata variables[/kb]
link to this article on your own board: Select All
[url=http://www.phpbb.com/kb/article/list-of-userdata-variables/]Knowledge Base - List of $userdata variables[/url]

$userdata variables are used to display information about a logged in user.

For example, to create a simple display of the logged in users username, you could use this code within your PHP script (note: the PHP script must be integrated into phpBB).

Code: Select all
echo $userdata['username'];


For registered users, their actual username would be displayed, while guests would see output of the text "Anonymous".

Below, is a list of all variables you can use, each serving a different purpose. $userdata['user_id'], $userdata['user_active'], $userdata['username'], and so on.

Code: Select all
    user_id
    user_active
    username
    user_password
    user_session_time
    user_session_page
    user_lastvisit
    user_regdate
    user_level
    user_posts
    user_timezone
    user_style
    user_lang
    user_dateformat
    user_new_privmsg
    user_unread_privmsg
    user_last_privmsg
    user_login_tries
    user_last_login_try
    user_emailtime
    user_viewemail
    user_attachsig
    user_allowhtml
    user_allowbbcode
    user_allowsmile
    user_allowavatar
    user_allow_pm
    user_allow_viewonline
    user_notify
    user_notify_pm
    user_popup_pm
    user_rank
    user_avatar
    user_avatar_type
    user_email
    user_icq
    user_website
    user_from
    user_sig
    user_sig_bbcode_uid
    user_aim
    user_yim
    user_msnm
    user_occ
    user_interests
    user_actkey
    user_newpasswd
    session_id
    session_ip
    session_user_id
    session_logged_in
    session_start
    session_admin
    session_key


All of the session data (ie. data relating to the particular session the user is logged in) is prefixed with session_, and these columns are the last seven of the above list.

Thanks to Noxwizard for allowing the list he constructed to be included in the Knowledge Base.