Created
November 14, 2012 10:55
-
-
Save corsonr/4071519 to your computer and use it in GitHub Desktop.
Adding BBpress private shortcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ------------------------------------------------------------------*/ | |
| /* 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