2016-06-26, 07:55 PM
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.:
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.:
I hope you enjoyed this tutorial and please let me know if you have any questions.
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.