Last active
May 13, 2017 04:57
-
-
Save raftaar1191/f98227016534ecc49158879c0fdba710 to your computer and use it in GitHub Desktop.
Disallow some tag for BuddyPress activity 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
<?php | |
// check if function does not exists | |
if ( ! function_exists( 'rtmedia_bp_activity_allowed_tags_callback' ) ) { | |
function rtmedia_bp_activity_allowed_tags_callback( $activity_allowedtags ) { | |
global $activities_template; | |
$rtmedia_type = array( 'rtmedia_update', 'rtmedia_like_activity', 'rtmedia_comment_activity' ); | |
// $activities_template exists and type not like $rtmedia_type. | |
if ( is_object( $activities_template ) && isset( $activities_template->activity ) && is_object( $activities_template->activity ) && isset( $activities_template->activity->type ) && ! in_array( $activities_template->activity->type, $rtmedia_type ) ) { | |
// check if ul exists. | |
if ( isset( $activity_allowedtags['ul'] ) ) { | |
unset( $activity_allowedtags['ul'] ); | |
} | |
// check if ul class exists. | |
if ( isset( $activity_allowedtags['ul']['class'] ) ) { | |
unset( $activity_allowedtags['ul']['class'] ); | |
} | |
// check if li exists. | |
if ( isset( $activity_allowedtags['li'] ) ) { | |
unset( $activity_allowedtags['li'] ); | |
} | |
// check if li class exists. | |
if ( isset( $activity_allowedtags['li']['class'] ) ) { | |
unset( $activity_allowedtags['li']['class'] ); | |
} | |
} | |
return $activity_allowedtags; | |
} | |
} | |
add_filter( 'bp_activity_allowed_tags', 'rtmedia_bp_activity_allowed_tags_callback', 1000, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment