Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created November 14, 2012 10:55
Show Gist options
  • Select an option

  • Save corsonr/4071519 to your computer and use it in GitHub Desktop.

Select an option

Save corsonr/4071519 to your computer and use it in GitHub Desktop.
Adding BBpress private shortcode
/* ------------------------------------------------------------------*/
/* ADD BBPRESS PRIVATE SHORTCODE */
/* ------------------------------------------------------------------*/
function remi_bbp_shortcodes( $content, $reply_id ) {
return do_shortcode( $content );
}
add_filter('bbp_get_reply_content', 'remi_bbp_shortcodes', 10, 2);
add_filter('bbp_get_topic_content', 'remi_bbp_shortcodes', 10, 2);
function remi_add_bbpress_private_shortcode( $atts, $content = null ) {
if( !current_user_can('administrator') ) {
echo do_shortcode( '[alert type="warning"]This content is private[/alert]' );
} else {
return '<span class="alert-message notice">'.$content.'</span>';
}
}
add_shortcode("private", "remi_add_bbpress_private_shortcode");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment