Skip to:
Content
Pages
Categories
Search
Top
Bottom

Moderator can only open topic

  • @enkoes

    Participant

    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

    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

    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

    the keymaster function was wrong, revised code is above.

    @enkoes

    Participant

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

    @robin-w

    Moderator

    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