[For 1.8] Display unique messages for different parts of your forum or usergroups

In this tutorial I will be showing you how you can display an unique message, to unique users, sections, threads or usergroups. We will be needing a plugin and some small PHP codes for this, but I will guide you through this. 


Step 1:
Upload Template conditionals and activate it from the plugins tab. 

Step 2:
Determine what you want to show, in this example I will be showing new members an alert to read our help documents. 

Step 3:
Open the template that you want your message in, mine is header templates -> header. I want my message to appear before everything else, so I put it below the container and above {pm_notice} and other stuff. 
Check screenshot: https://i.imgur.com/Axs9azp.png

Step 4:
Use the following code:
<if $mybb->user['usergroup'] == "USERGROUPIDHERE" then>
Your message here
This uses the ID of the display usergroup, if you want to show a message to users whom are part of a group but do not have it as display, click here.

Step 5:
Edit the "USERGROUPIDHERE" to your desired usergroup. If you want to use multiple groups, use this code:
<if $mybb->user['usergroup'] == "1" || $mybb->user['usergroup'] == "2" then>
Change the 1 & 2 to whatever usergroup you desire.

Step 6:
Edit the "your message here" to your desired HTML.

Additional information:
You can use this practically for anything you want. I am currently just showing that message to users who have the registered usergroup and a couple warning messages that display when posting a new thread in a certain section. If you want to display a message in a certain section, change the top line with this:
<if $forum['fid'] == "FORUMIDHERE" then>

If you need help or assistance, you can tweet me at @Perileos 
My help/assistance is free as long as you can respect me and my time. 

Kind regards,
A. Longbeach

Messages In This Thread
Display unique messages for different parts of your forum or usergroups - by Alexander L. - 2020-03-22, 12:28 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)