Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Hide a section from the ddl when adding a new topic


ardentfrost
Member

@ardentfrost

Until a plugin is made, I think you’d have to pseudo-hardcode it. I was able to limit what admins and regular users could see in my memberlist by adding the following code:

<?php if (bb_current_user_can('edit_users')) : ?>

*some code here*

<?php endif; ?>

There are other options you can test on, that’s just the one I found to use.

For you, in the *some code here* part, you’ll need to find a way to pull out what forums you got, and put an if statement to say only to show the Announcements one to admins.

Looking at the files, I found a function called “forum_dropdown” in template functions. If you go there and within the foreach section, below the $selection part, put the following:

if ( $forum->forum_name == 'Announcements' && !bb_current_user_can('edit_users') ) { }

else

That will do nothing when it gets to listing your “Announcements” section unless the user is an admin. The else is for the echo line below where I told you to put the previous line.

Of course, this is a change to a core file, but sometimes that’s just what you gotta do until a plugin is made :D Furthermore, there is no filter to be added there, so writing a plugin would mean rewriting that function, dropping it in a plugin file, and calling the replacement function from post-form.php

Skip to toolbar