Login Register






Making a custom MyBB Variable - How to make your username formatted in welcome block filter_list
Author
Message
Making a custom MyBB Variable - How to make your username formatted in welcome block #1
I've been recently learning PHP and I'm pretty far on with it now. I'm just testing out different functions on MyBB which can make your board more custom/unique.

Today I'm going to show you how to make your username in the 'Welcome Block' formatted to whichever usergroup you are in.

End result of tutorial:

Spoiler:
[Image: b48cad5f9ef9d39fec2043edc4aca55b.png]


Here's how:

Open up FileZila or cPanel. You're going to be editing the "global.php" file so open that file up in your code editor.

Once the global.php file is open, search for this line:

Quote:// Format the welcome back message

Just underneath it, paste this (I'll explain it afterwards):

PHP Code:
$formatted_user_welcome = format_name($mybb->user['username'], $mybb->user['usergroup'], $mybb->user['displaygroup']);


The $formatted_user_welcome part of the code is our PHP variable. Whatever it's value is, is written after the "=". The code on the other side of the "=" defines what we want to do, which in this case is to style your username.

Save that global.php file and re-upload it.

Now open up your AdminCP. Go to templates -> your theme -> header -> header_welcomeblock_member

Now paste this MyBB variable anywhere you like:
PHP Code:
{$formatted_user_welcome}

This will display whichever user is logged in's username.

I hope this was easy for everyone to understand.

Reply

RE: Making a custom MyBB Variable - How to make your username formatted in welcome block #2
Thanks for this. I will use this on my site

Reply

RE: Making a custom MyBB Variable - How to make your username formatted in welcome block #3
Great, small tut there, Blue. Easy to follow and easy to understand. Keepin' it HQ as usual.
(This post was last modified: 06-07-2013, 05:04 PM by SeanFace101.)
[Image: a319ef9581853.560e3236d2b0b.png]

Reply

RE: Making a custom MyBB Variable - How to make your username formatted in welcome block #4
Thank you Blue!
I needed this
Help me out by clicking these links, thanks!
Link1 | Link2 | Link3 | Link4

Reply

RE: Making a custom MyBB Variable - How to make your username formatted in welcome block #5
Our special Blue is going to be awesome, just wait! I don't understand alot, but it's good to hear you're pretty far in with PHP!
hello

Reply