MyBB Community Forums

Full Version: Code for viewable to guests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know with IPB you can add a line of code which allows you to make objects with the template viewable to certain groups and a-like.

Does Mybb have their own way of doing this?

I'm not sure what the code is but would appreciate any help.
~Kerrang!
By default, no. Search for Yumi's PHP Template Conditionals or something to that effect, it's a plugin.
Thanks Scoutie44

Found the plug, not sure how I can achieve the guest side of it though. I'm no coder by fan, would anyone be able to assist me? I would honestly appreciate any help with this because I have no idea how to.

Quote:<if $GLOBALS['mybb']->user['usergroup'] == 4 then> stuff for usergroup 4</if>
^ What's that code doing?

Sorry to sound such a newbie but I'm trying to have a basic guest message, the message is all set but I can't show it to just that user group at the moment.
Change the usergroup ID (in that example is 4) with the guest usergroup id (1 by default). And change the "stuff for usergroup 4" with the messages.
(2009-11-01, 05:49 PM)Kerrang! Wrote: [ -> ]
Quote:<if $GLOBALS['mybb']->user['usergroup'] == 4 then> stuff for usergroup 4</if>
^ What's that code doing?

It works like this;

If the current user's usergroup is 4 (gid), then do this.

If you want to show something for guests, do something like this:

<if $GLOBALS['mybb']->user['uid'] == 0 then> stuff for guests</if>
(2009-11-01, 06:25 PM)RateU Wrote: [ -> ]Change the usergroup ID (in that example is 4) with the guest usergroup id (1 by default). And change the "stuff for usergroup 4" with the messages.

(2009-11-01, 06:27 PM)Scoutie44 Wrote: [ -> ]
(2009-11-01, 05:49 PM)Kerrang! Wrote: [ -> ]
Quote:<if $GLOBALS['mybb']->user['usergroup'] == 4 then> stuff for usergroup 4</if>
^ What's that code doing?

It works like this;

If the current user's usergroup is 4 (gid), then do this.

If you want to show something for guests, do something like this:

<if $GLOBALS['mybb']->user['uid'] == 0 then> stuff for guests</if>
I feel a little silly now! I appreciate you both taking time to explain for me, I hate adding or playing with code when I don't understand it. (when you've messed up many things you tend to take a step back)

Looks awesome and I can't thank you enough.

~Kerrang!

P.s It's a shame I can't give rep to you both, it would be a small way to show how helpful you both are. awesome Smile