MyBB Community Forums

Full Version: Hide specific forum to a user
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm trying to hide a specific forum to a user. I know I can do that from the forum settings but I can't use  this features because many users from the same group can have different access level (based on my plugin).

Explain the structure is how my plugin works will be long and worthless so instead I'll just explain what behavior I need.

If I edit the function build_forumbits and add this code 
if($forum['fid'] == 9)
{
				
    continue;
}

Just before the run_hook method :
$forum = $plugins->run_hooks("build_forumbits_forum", $forum);

The forum with id 9 didn't display on the page.

And this is exactly what i'm trying to do but from my plugin file (using the hook system).

PS. In really it's more complex but explain why I don't create different group etc will be long so if I can hide the forum with id 9 from inside my plugin hook it will resolve my problem  Smile )

Thanks
You must be very careful to get every instance where this might be an issue:
* Forum stats might include the forum you wish to hide
* Last post on portal
* Posts when looking for a User's posts
* etc

Also, your plugin should check $mybb->user in addition to $forum so that the forum is only hidden from certain users.
(2017-11-06, 07:32 PM)laie_techie Wrote: [ -> ]You must be very careful to get every instance where this might be an issue:
* Forum stats might include the forum you wish to hide
* Last post on portal
* Posts when looking for a User's posts
* etc

Also, your plugin should check $mybb->user in addition to $forum so that the forum is only hidden from certain users.

Yeah I'm aware of that but I don't even think it's possible to do what I want without using additionnal group and I don't want a user to have other group.

I'll just modify the code of mybb.