MyBB Community Forums

Full Version: Include 'easter eggs' for certain users or groups,
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I thought that today I'd share something that I've used on my own forum here so others are able to benefit from it. A nice little touch up on your forum is to include 'easter eggs' for certain users or groups. For this tutorial you'll need a special plugin which allows you to use PHP in templates (you may find the plugin at: http://mybbhacks.zingaburga.com/showthread.php?tid=260).

For certain usergroups:
You'll need to decide where on the site the 'easter egg' should be and include the following PHP code in the template for the desired location.:
<?php
$mygroup = $mybb->user['usergroup'];
if($mygroup == 'GROUP ID # HERE') {
echo 'EASTER EGG HTML CODE HERE';
} else {
echo '';
}
Only users in that specific user group will see it. You may include additional user groups by adding this code above the 'else' word on line 5:
elseif($mygroup == 'ANOTHER GROUP ID # HERE') {
echo 'ANOTHER EASTER EGG HTML CODE BLOCK HERE';
}

I often use this code to display messages to the Staff or Admin group such as a reminder for a meeting among other notifications.

For certain users:
Often it's nice to include an 'easter egg' for certain users. As with the previous tutorial you will first need to decide where on site to display the easter egg and then include the following PHP code in the template for the desired location.:
<?php
$specialuser = $mybb->user['username'];
if($specialuser == 'USERNAME HERE'){
echo 'EASTER EGG HTML CODE HERE';
} else {
echo '';
}
And as with the previous tutorial you may add other users by adding the following PHP code before 'else' word on line 5.:
elseif($specialuser == 'ANOTHER USER NAME HERE') {
echo 'ANOTHER EASTER EGG HTML CODE HERE';
}

I hope you enjoyed this tutorial and please let me know if you have any questions.
I become inappropriately angry a while back (not related to an issue on the community forums just a MyBB issue in general which was fixed) and removed my two tutorials from MyBB.com a while back. I apologize for this behavior and am adding them back.
Could be even shorter if you wanted:
<if $mybb->user['uid'] == 15 then>
<strong>We see you lurking John, how's it going?</strong>
</if>