MyBB Community Forums

Full Version: Add 2 GID to this php code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Need some support. I wish to hide a table for different group IDs. I am currently using:
<if $memprofile['usergroup'] != 2 then>

However, I wish to add about 2-3 more group IDs. What would be the proper way of adding them? Sorry if its a noob question, my memory just isnt great right now  Rolleyes

Edit: Turns out maybe this code isn't what I want it to do. I want to hide this table for every member in GID 2,1,10 and if they are in these groups, then they can not see the table
You could try something like:

<if in_array($memprofile['usergroup'], array(2, 3, 4)) then>

Where 3 and 4 are the additional groups. I've not used the template conditionals plugin much, but I believe that should work.

PS: Move to plugin support as template conditionals are not a core feature in 1.8.
(2020-04-01, 07:30 PM)Euan T Wrote: [ -> ]You could try something like:

<if in_array($memprofile['usergroup'], array(2, 3, 4)) then>

Where 3 and 4 are the additional groups. I've not used the template conditionals plugin much, but I believe that should work.

PS: Move to plugin support as template conditionals are not a core feature in 1.8.

That didn't seem to work.

Sorry about posting in the wrong section, I thought this was the right one but you're correct. Will not do it again
(2020-04-01, 07:19 PM)makpaolo Wrote: [ -> ]I want to hide this table for every member in GID 2,1,10 and if they are in these groups, then they can not  see the table

For the current user try it this way

<if !is_member(array(1,2,10)) then>
   // your table
</if>
The code that Euan T provides you it's fine but will work only into profiles part you must play around values you need to be MORE specific in wich part would be required because you use that code and we supose that you have an idea of what is suposed the code do.

So it will work fine but into user's profiles only, try it and let uscknow but it's highly recommended if yoy say the template or zone where you will use due for posts only $post besides $memprofile should work and in other parts $user, etc.

But yeah as doylecc said that will compare the current account if it's a part of those groyps to do something too, but it's better if you let us know what exactly wanna do if shows x for x members contents or x content available for x members, etc.