MyBB Community Forums

Full Version: $Mybb Variable List
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
This is a work in progress, this is not complete, nor 100% accurate. Requested from this thread post. I made this mainly as a reference for me however may be useful for new plugin developers.

User $mybb->user['xxx']
  • uid - Returns the currently logged in user's UID from the database (example: 1)

  • username - Returns the currently logged in user's username from the database (example: Miah)

  • password - Returns the currently logged in user's encrypted password from the database (example: 1575c0734578538326)

  • salt - Returns the currently logged in user's custom salt used to decrypt the password during login (example: 5kVI8A7U)

  • email - Returns the currently logged in user's email from the database (example: [email protected])

  • postnum - Returns the currently logged in user's post number from the database (example: 100)

  • avatar - Returns the currently logged in user's avatar from the database (example: ./directory/avatar.jpg?dateline=#)

  • avatardimensions - Returns the currently logged in user's avatar dimensions seperate by a '|' (example: 200|200)

  • avatartype - Returns the currently logged in user's avatar type (example: upload)

  • usergroup - Returns the currently logged in user's usergroup (example: 4)

  • additionalgroups - Returns the currently logged in user's additional usergroups separated by a comma (example: 3,2)

  • displaygroup - Returns the currently logged in user's display group (example: 4)

  • usertitle - Returns the currently logged in user's user title (example: MyBB Staff)

  • regdate - Returns the currently logged in user's registration date in time() format (example: 1394565678)

  • lastactive - Returns the currently logged in user's last active time in time() format (example: 1387347924)

  • lastvisit - Returns the currently logged in user's last visit time in time() format (example: 1383729820)

  • lastpost - Returns the currently logged in user's last post time in time() format (example: 1383792830)

  • website - Returns the currently logged in user's website if specified (example: http://www.mybb.com)

  • icq, msn, aim, yahoo - Returns the currently logged in user's instant messager accounts if specified (example: miah)

  • birthday - Returns the currently logged in user's birthday (hidden or not, example: 1-12-1990 [day-month-year])

  • birthdayprivacy - Returns the currently logged in user's privacy settings for birthday (example: all)

  • signature - Returns the currently logged in user's signature if added (example: Miah's Signature)

  • allownotices - Returns the currently logged in user's notice settings

  • invisible - Returns the currently logged in user's invisible status (1 = yes, 0 = no - example: 1)

  • receivepms - Returns the currently logged in user's receive settings for PMs (example: 1)

  • showsigs, showavatars, showquickreply, showredirect - Returns the currently logged in user's settings (example: 1)

  • referrer - Returns the currently logged in user's referrer if any (example: 4)

  • referrals - Returns the currently logged in user's referral amount (example: 2)

  • reputation - Returns the currently logged in user's reputation amount (example: 392)

  • regip - Returns the currently logged in user's IP in which they registered with (example: 127.0.0.1)

  • lastip - Returns the currently logged in user's IP in which they were last active with (example: 127.0.0.1)

  • timeonline - Returns the currently logged in user's total active time in time() format (example: 1383792830)

  • totalpms - Returns the currently logged in user's total amount of PMs (example: 42)

  • unreadpms - Returns the currently logged in user's total amount of unread PMs (example: 10)

  • warningpoints - Returns the currently logged in user's total amount of warning points (example: 1)

  • ismoderator - Returns the currently logged in user's moderator status (1 = yes, 0 = no, example: 1)

Version $mybb->version
  • Returns the current version of MyBB

Usergroup $mybb->usergroup['xxx']
  • disporder - The order in which the usergroup will display depending on the number (example: 0)

  • isbannedgroup - Returns whether or not the user group is the banned group (example: 1)

  • canview - Returns whether or not the user group can view the forum (example: 1)

  • canviewthreads - Returns whether or not the user group can view threads (example: 1)

  • canviewprofiles - Returns whether or not the user group can view profiles (example: 1)

  • candlattachments - Returns whether or not the user group can download attachments (example: 1)

  • canpostthreads - Returns whether or not the user group can post threads (example: 1)

  • canpostreplys - Returns whether or not the user group can post replies (example: 1)

  • canpostattachments - Returns whether or not the user group can post attachments (example: 1)

  • canratethreads - Returns whether or not the user group can rate threads (example: 1)
You can use:

echo "<pre>";
print_r($mybb);
echo "</pre>";

to get them all.
Quote:... in time() format ...

To be picky, time() returns a Unix timestamp. It isn't unique to time().

http://en.wikipedia.org/wiki/Unix_time

Quote:Returns the currently logged in user's encrypted password from the database

The passwords are hashed, not encrypted. Hashing and encryption are two different things. You cannot decrypt the password.
Nice thread. Thanks for list!
$mybb->user['lastvisit' Isnt correct its {$lastvisit}
(2015-02-22, 09:09 AM)UnfedZombie Wrote: [ -> ]$mybb->user['lastvisit' Isnt correct its {$lastvisit}

It is correct.. The 1st variable uses UNIX time (as the description says), the 2nd is based on it but formatted with my_date().
Hi,

variable:

<if $post['postnum'] == 0 then> Content </if>

doesn't work to me, I see the if content also if I have more than 1 posts. I would like that if user has 0 posts he sees the content, otherwise not. How can I resolve?

Thank you
Try


<if $mybb->user['postnum'] < 1 then>content</if>
Thank you Lee! Big Grin

I have used also:

<if $mybb->user['postnum'] < 1 && $mybb->user['usergroup'] != 1 then>

and work perfectly, thank you Big Grin
Good thread idea, I suggest to add it in the official doc
Pages: 1 2 3