i have just tried to use the shortcode [ms-protect-content

Hi, i have just tried to use the shortcode [ms-protect-content id="6639"]blah blah[/ms-protect-content] inside a buddy forum post to protect part of that and it isn't working.

Am i doing something wrong or does it not cover content inside forums? (i only want sections of the posts protected - essentially reference notes - that non-admins cannot see)


  • Ash

    Hello @jacci

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    This is default behavior of BBPress. Please use the following code:

    function pw_bbp_shortcodes( $content, $reply_id ) {
    	$reply_author = bbp_get_reply_author_id( $reply_id );
    	if( user_can( $reply_author, pw_bbp_parse_capability() ) )
    		return do_shortcode( $content );
    	return $content;
    add_filter('bbp_get_reply_content', 'pw_bbp_shortcodes', 10, 2);
    add_filter('bbp_get_topic_content', 'pw_bbp_shortcodes', 10, 2);
    function pw_bbp_parse_capability() {
    	return apply_filters( 'pw_bbp_parse_shortcodes_cap', 'publish_forums' );

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.