Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Shoutbox visable to certian groups only?
ArchPrime Offline
Junior Member
**
Posts: 3
Joined: Jul 2012
Post: #1
Shoutbox visable to certian groups only?
Hi - I have installed Template conditional, and also have Ajax Shoutbox working

I want to make this shoutbox invisable to banned users and guests and those awaiting activation

Editing the Index template (where shoutbox is invoked)

I changed this

{$shoutbox}

to this

<if !in_array($GLOBALS['mybb']->user['usergroup'], array(2,3,4,6)) then>
{$shoutbox}
</if>

but it does not work - I get no error, but with that change, shoutbox is now invisible to ALL user groups

I know nothing about php scripting, and the above is my just my best guess based on other forum postings on similar issues.

I obviously have something wrong though, and would be very grateful for corrected version!

Cheers
07-31-2012 07:36 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Shoutbox visable to certian groups only?
Are you sure you got the group IDs correct?
Also, are you trying to hide from certain users or make visible to certain users?  Your code above hides the content from the listed group IDs.

My Blog
07-31-2012 08:06 PM
Find all posts by this user Quote this message in a reply
ArchPrime Offline
Junior Member
**
Posts: 3
Joined: Jul 2012
Post: #3
RE: Shoutbox visable to certian groups only?
Hi - I am basing my group IDs on the order in which they are listed by default in AdminCP/Users and Groups/Groups.  

So I am assuming "1" would be Guests, "2" would be Registered users , "3" would be Super Moderators .. etc

If wrong, are the correct IDs listed anywhere?  I have not been able to find a complete list explicitly relating group number  to group  name anywhere.

I also did not realize I was hiding content this way !  What should the script be to instead reveal {$shoutbox} to only groups 2,3,4 & 6 ?

Cheers
(This post was last modified: 07-31-2012 09:01 PM by ArchPrime.)
07-31-2012 09:00 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Shoutbox visable to certian groups only?
Your method of getting IDs is probably accurate (for now), but I wouldn't count on it.  Just edit a group and look for a gid= in the URL - this will be the real group ID.

The exclamation mark (!) means 'not', so try removing that.

My Blog
(This post was last modified: 07-31-2012 11:40 PM by ZiNgA BuRgA.)
07-31-2012 11:38 PM
Find all posts by this user Quote this message in a reply
ArchPrime Offline
Junior Member
**
Posts: 3
Joined: Jul 2012
Post: #5
RE: Shoutbox visable to certian groups only?
(07-31-2012 11:38 PM)ZiNgA BuRgA Wrote:  Your method of getting IDs is probably accurate (for now), but I wouldn't count on it.  Just edit a group and look for a gid= in the URL - this will be the real group ID.

The exclamation mark (!) means 'not', so try removing that.

Hi - I confirmed the gid's are indeed as predicted, and deleted the exclamation mark - but no change in performance:

<if in_array($GLOBALS['mybb']->user['usergroup'], array(2,3,4,6)) then>
{$shoutbox}
</if>

still never invokes {$shoutbox}, though shoutbox does appear normally if I simply add {$shoutbox} above or below this conditional statement.

Is there something wrong with the way this is looking up the usergroup array?

As a check, if I simply wanted the GID to be printed to the index page, and a flag to be set, printing "yay it works" if GID is one of 2,3,4 or 6, how would I do this?

(I reveal my total ignorance here - the only coding I have ever done was in basic! many years ago!)

Cheers
08-01-2012 05:39 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: Shoutbox visable to certian groups only?
The code works fine for me, so I really don't know why it's failing for you.
I guess you could try:

Code:
<if true then>{$shoutbox}</if>

to see if conditionals work at all.

Otherwise, if you can set up a clean test board and provide the exact steps to reproduce the issue, I can try looking into it for you.


My Blog
08-01-2012 09:58 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: