Last active
August 29, 2015 14:20
-
-
Save duogeekdev/313450071bad10f8340e to your computer and use it in GitHub Desktop.
How to enable shortcode in BBPress reply
This file contains 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
<?php | |
add_filter('bbp_get_reply_content', 'bb_sc_render', 99, 2); | |
add_filter('bbp_get_topic_content', 'bb_sc_render', 99, 2); | |
function bb_sc_render( $content, $reply_id ) { | |
$reply_author = bbp_get_reply_author_id( $reply_id ); | |
if( current_user_can( 'manage_options' ) ) | |
// You can use custom capability, like: | |
// current_user_can( 'custom_cap' ) | |
return do_shortcode( $content ); | |
return $content; | |
} |
This file contains 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_filter('bbp_get_reply_content', 'bb_sc_render', 99, 2); | |
add_filter('bbp_get_topic_content', 'bb_sc_render', 99, 2); | |
function bb_sc_render( $content, $reply_id ) { | |
$reply_author = bbp_get_reply_author_id( $reply_id ); | |
if( user_can( $reply_author, 'publish_forums' ) ) | |
return do_shortcode( $content ); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment