Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide “New Topic” Form on Certain Pages


  • bradm413
    Participant

    @bradm413

    bbPress Version 2.6.9
    WP version 5.8.2
    site: https://branchtheworld.com

    I have searched and haven’t found an exact case like what I’m looking for. I would like to hide the “New Topic” form that displays when using this shortcode:

    [bbp-single-forum id=$forum_id] – Display a single forums topics. eg. [bbp-single-forum id=32]

    See screenshot here:
    screenshot

    Is this something I’ll need to do with custom coding, or is there a plugin or another simple way to achieve this?

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

  • Robin W
    Moderator

    @robin-w

    so do you want to hide the new topic form every time this particular forum displays (easier), or just for this particular shortcode on a page (more difficult) ?


    bradm413
    Participant

    @bradm413

    Ideally, I would like to dynamically hide this New Topic form, based on my needs. Since that is the more difficult path, can you just give me a high-level idea of where to start? I have built a local unpublished plugin before, so I can go down that route if I need to.

    And the for the easier option, how would I just hide it every time for now?

    Thanks!


    Robin W
    Moderator

    @robin-w

    Untested, but find
    wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php

    transfer this to your pc and edit

    change line 31

    from

    <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>

    to

    <?php if ( bbp_current_user_can_access_create_topic_form() && (bbp_get_forum_id() != '2927') ) : ?>

    and save

    where 2927 is the forum you don’t want to show the form for

    then create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/form-topic.php

    bbPress will now use this template instead of the original

    If you want multiple forums, you could create and array and test against that


    bradm413
    Participant

    @bradm413

    Thanks for the reply here, and sorry for my late one.

    I’ve been working on this, and I think it will fit my needs better to prevent certain user types from being able to create new topics in this particular forum. Is that something that’s easier to do?

    I have BuddyPress installed, and right now I have Group Types defined. So maybe all users in a certain BuddyPress Group cannot create new topics for this particular forum.

    I could create Member Types in BuddyPress if that’s better to use.


    bradm413
    Participant

    @bradm413

    Sorry, I will also clarify that I’m going to use your method of hiding the form in some cases, too. I just want to make sure certain user types are not creating new topics in this certain forum (i.e. by manually typing in the URL to do so).

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