Commit 3b8b2322 authored by John James Jacoby's avatar John James Jacoby

Only filter activity action content when not in wp-admin.

parent 0349385a
......@@ -16,9 +16,21 @@ add_filter( 'bp_activity_recurse_comments_start_ul', '__return_false' );
add_filter( 'bp_activity_recurse_comments_end_ul', '__return_false' );
remove_filter( 'bp_get_activity_action', 'wpautop' );
add_filter( 'bp_get_activity_action', function( $action = '' ) {
/**
* Filter the activity action and manipulate the content a bit
*
* @global object $activities_template
* @param string $action
* @return string
*/
function swifter_activity_filter_action( $action = '' ) {
global $activities_template;
// Bail if in wp-admin
if ( is_admin() ) {
return $action;
}
$date = isset( $activities_template->activity->date_recorded )
? $activities_template->activity->date_recorded
: $activities_template->activity->current_comment->date_recorded;
......@@ -29,12 +41,25 @@ add_filter( 'bp_get_activity_action', function( $action = '' ) {
$new_action = str_replace( '</span>', '</small>', $action );
$new_action = str_replace( 'span class="time-since"', 'small class="time-since pull-right" data-toggle="tooltip" data-placement="top" title="' . $date_recorded . '"', $new_action );
return $new_action;
} );
}
add_filter( 'bp_get_activity_action', 'swifter_activity_filter_action' );
add_filter( 'bp_activity_permalink', function( $action = '' ) {
$new_action = str_replace( 'title="' . esc_attr__( 'View Discussion', 'swifter' ) . '"', '', $action );
return $new_action;
} );
/**
* Filter the activity permalink and naipulate the string output
*
* @param string $action
* @return string
*/
function swifter_activity_filter_permalink( $action = '' ) {
// Bail if in wp-admin
if ( is_admin() ) {
return $action;
}
return str_replace( 'title="' . esc_attr__( 'View Discussion', 'swifter' ) . '"', '', $action );
}
add_filter( 'bp_activity_permalink', 'swifter_activity_filter_permalink' );
/**
* Get available filters depending on the scope.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment