MyBB Community Forums

Full Version: Get the group ID of the user in the post bit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I think the postbit has a variable for username for who posted. I forget what it is atm. How would I get the group ID of that username for that post.

I want to use the PHP In Templates plugin, and remove the Report button for posts from users in certain groups (admin, mod, etc).

I read somewhere that, this may be harder to do because of the way its all setup to run. But I am not sure.

Is there a more advanced function for users. I know there is get_user...

 <if $post['username']->['usergroup'] <> 4 then>

Epicly failed, but hey theres that variable i was talkin about.
<if $post['usergroup'] != 4 then>
// show this to usergroup not 4
{$post['report_button']}
</if>

But you should also consider additional usergroups.
(2012-07-26, 07:26 AM)Omar G. Wrote: [ -> ]
<if $post['usergroup'] != 4 then>
// show this to usergroup not 4
{$post['report_button']}
</if>

But you should also consider additional usergroups.

Good so then I can just use the array version and if I need to add user groups it will be easier:

<if !in_array($post['usergroup'], array(4)) then>

Is there a way I could do it where, if I added a new group or the GID's changed around that Administrator no matter what based on its name would still be in that array...?

Okay it WORKS! But why can admins still see their own report button? Maybe there is an admin template?
No sure about that, but even if your username changes your usergroup is always the same, unless you stop being a admin.