Skip to:
Content
Pages
Categories
Search
Top
Bottom

Moderator can only open topic


  • enkoes
    Participant

    @enkoes

    Hi I’m planning to auto-close topic probably after it has been idle for 3 months.

    Thus I need to adjust the role capability of moderators so that they can only OPEN a closed topic but cannot close a topic.

    From the frontend, I would HIDE the admin link “close” for a logged in moderator, but DISPLAYING the admin link “open” for any closed topic. Can we do that?

    Regards.

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

  • Robin W
    Moderator

    @robin-w

    on holiday at the moment, so untested solution !!

    But try

    add_filter( 'bbp_topic_admin_links' , 'rew_no_close', 10 , 1) ;
    
    function rew_no_close ($r) {
    	if (!bbp_is_user_keymaster() && bbp_is_topic_open()) {
    		unset ($r['close']) ;
    	}
    return $r ;
    }

    This should ensure that only keymasters can close topics (assumes moderators have no backend access)

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

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

    or use

    Code Snippets


    enkoes
    Participant

    @enkoes

    Thanks for replying me on yr holiday. 🙂

    I applied yr given code with minor correction of syntax error:
    unset($r['close']) ;

    The code however return generic critical error message in the webpage. Anything wrong?

    Regards


    Robin W
    Moderator

    @robin-w

    the keymaster function was wrong, revised code is above.


    enkoes
    Participant

    @enkoes

    Simple codes do the tricks. Thanks for your kind support!


    Robin W
    Moderator

    @robin-w

    great – glad you are fixed

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