Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Disable myCRED Shortcodes
- * Disable / Remove myCRED shortcodes from wp content,
- * BuddyPress activity and messages.
- * @version 1.0
- */
- add_filter( 'the_content', 'mycred_pro_disable_shortcodes' );
- function mycred_pro_disable_shortcodes( $content = '' ) {
- if ( is_admin() ) return;
- global $post;
- if ( ! isset( $post->post_content ) || user_can( $post->post_author, 'edit_users' ) ) return;
- $content = str_replace( array( '[mycred', '[ mycred' ), '[not allowed', $content );
- return $content;
- }
- add_filter( 'bp_get_activity_content_body', 'mycred_pro_disable_shortcodes_bp' );
- function mycred_pro_disable_shortcodes_bp( $content, $activity ) {
- if ( ! isset( $activity->user_id ) || user_can( $activity->user_id, 'edit_users' ) ) return;
- $content = str_replace( array( '[mycred', '[ mycred' ), '[not allowed', $content );
- return $content;
- }
- add_action( 'messages_message_before_save', 'mycred_pro_disable_shortcodes_bp_message' );
- function mycred_pro_disable_shortcodes_bp_message( $message ) {
- if ( ! isset( $message->sender_id ) || user_can( $message->sender_id, 'edit_users' ) ) return;
- $message->message = str_replace( array( '[mycred', '[ mycred' ), '[not allowed', $message->message );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement