MyBB Tutorials

Useful Template Codes

Submitted by Aoki, , Thread ID: 10

Thread Closed
15-01-2015, 12:34 AM
#1
Code:
{$welcomeblock} - Include welcomeblock (user/guest view of the member bit)
{$mybbversion} - Displays softwares version
{$modcplink} - Displays link to Mod CP
{$admincplink} - Displays link to Admin CP (exclude for clients safety - reinstate it if requested)

{$mybb->settings['bbname']} - Displays boards name
{$mybb->settings['bburl']} - Displays URL to the board (use always when you have to link to something)
{$mybb->settings['homename']} - Displays homepage name (the one in the footer's menu)
{$mybb->settings['homeurl']} - Displays URL to the homepage site (the one in the footer's menu)

{$mybb->user['username']} - Displays users username
{$mybb->user['usertitle']} - Displays users usertitle
{$mybb->user['uid']} - Displays users UID (User ID)
{$mybb->user['avatar']} - Displays URL of the users avatar
{$mybb->user['lastvisit']} - Displays users last visit (date and time)
{$mybb->user['totalpms']} - Displays the total number of users messages (unread + read)
{$mybb->user['unreadpms']} - Displays number of users unread messages
{$mybb->user['postnum']} - Displays the users post count
{$mybb->user['logoutkey']} - Displays users logout key (used to logout successfully)

{$theme['imgdir']} - Displays themes image dirrectory
{$theme['imglangdir']} - Displays language specific theme image dirrectory
{$theme['tid']} - Displays the themes ID number
{$theme['logo']} - Displays themes logo
{$theme['borderwidth']} - Displays themes borderwidth number
{$theme['tablespace']} - Displays themes tablespace number

{$forum['name']} - Displays forums title
{$forum['description']} - Displays forums description
{$forum['url']} - Displays forums URL
{$forum['fid']} - Displays forums ID number

RE: Useful Template Codes

#2
I just want to know one thing x)
If i add in a template a condition (PHP) code with : $mybb->user['uid'] == 10
Will it work ?
I did'nt try this, i'm learning the PHP/MySQL languague to find solutions myself, so no much time, with life stuffs too
- Web Developer & Designer

Website : https://developement.design/
Skype : ef.team
Email : [email protected]

RE: Useful Template Codes

#3
You can't use PHP in templates if you don't have installed a plugin to do so

RE: Useful Template Codes

This post was last modified: 17-05-2015, 10:44 PM by DarSider
#4
17-05-2015, 09:20 PM
AndresXZ09 Wrote:
You can't use PHP in templates if you don't have installed a plugin to do so

So i don't have a solution without a plugin
I will try these stuffs when i will finish my PHP/MySQL lessons
Thanks

Thank you
I found this : http://community.mybb.com/thread-31860.html :D
Will share it when i can
- Web Developer & Designer

Website : https://developement.design/
Skype : ef.team
Email : [email protected]

RE: Useful Template Codes

#5
Use PHP in Templates 2.0

And also, try with this code

<if $GLOBALS['mybb']->user['uid'] == 1 then>Stuff</if>

RE: Useful Template Codes

#6
Thank you for sharing these codes! I never knew there were so many template codes for Mybb. This thread is a keeper Smile
- Signature removed by staff

RE: Useful Template Codes

This post was last modified: 29-05-2015, 02:57 AM by AndresXZ09
#7
One question, is there a way to show the member profile UID without using a plugin? Because when I use {$mybb->user['uid']} it shows mine instead of the user uid.

EDIT: Nevermind, found it.

RE: Useful Template Codes

#8
I begin "the adventure" with MyBB, but this topic is very helpful. Thank you Wink

Users browsing this thread: 5 Guest(s)