Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide a section from the ddl when adding a new topic

  • Hi,

    If you want to add a new topic, you can do this by clicking the Add new link from the forum index. On the bottom you can choose from a ddlb in wich section you want to post this new topic.

    Lets say I have the sections:

    -Announcements

    -Chit chat

    -Troubleshooting

    At the moment, every member can start new topics where ever they like. How can I change this so only Admins and moderators can post in Announcements but members can’t?

    So basicly, how do I HIDE Announcements from the ddlb when you are a member and shows it in the ddlb when you are an Admin/ moderator?

    Greetz

    Note: akso the post form should be hidden when some one tries to post a new topic using the Announcement’s topiclist

Viewing 2 replies - 1 through 2 (of 2 total)

  • 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

    Well I think it safe to assume that a function like this; ristricting forum postings for admin/ moderators only, will be added in future bbpress release, cause all forums can do this.

    So I will wait for a “Only admin/ moderators can make new posts in this forum” option.

    Thx

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar