Skip to content

Commit

Permalink
Compliments in activity dropdown filter is ambiguous - FIXED
Browse files Browse the repository at this point in the history
  • Loading branch information
viruthagiri committed Aug 25, 2015
1 parent caff501 commit f3289c2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 2 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ v0.0.8
Option added to enable/disable activity component - ADDED
Option added to enable/disable notifications component - ADDED
Added placeholder text to message textarea - ADDED
Compliments in activity dropdown filter is ambiguous - FIXED
Undefined property ID notice - FIXED

v0.0.7
Compliments can be renamed to anything Ex: "Gifts" - ADDED
Expand Down
28 changes: 25 additions & 3 deletions includes/bp-compliments-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function compliments_format_activity_action_compliment_received( $action, $activ
$bp_compliment_can_see_others_comp_value = esc_attr( get_option('bp_compliment_can_see_others_comp'));
$bp_compliment_can_see_others_comp = $bp_compliment_can_see_others_comp_value ? $bp_compliment_can_see_others_comp_value : 'yes';

if ($bp->loggedin_user->id == $bp->displayed_user->id) {
if (bp_is_user() && ($bp->loggedin_user->id == $bp->displayed_user->id)) {
$bp_compliment_can_see_others_comp = 'yes';
}

Expand Down Expand Up @@ -194,7 +194,7 @@ function compliments_format_activity_action_compliment_sent( $action, $activity
$bp_compliment_can_see_others_comp_value = esc_attr( get_option('bp_compliment_can_see_others_comp'));
$bp_compliment_can_see_others_comp = $bp_compliment_can_see_others_comp_value ? $bp_compliment_can_see_others_comp_value : 'yes';

if ($bp->loggedin_user->id == $bp->displayed_user->id) {
if (bp_is_user() && ($bp->loggedin_user->id == $bp->displayed_user->id)) {
$bp_compliment_can_see_others_comp = 'yes';
}

Expand Down Expand Up @@ -259,4 +259,26 @@ function compliments_delete_activity_for_user( $user_id ) {
'secondary_item_id' => $user_id
) );
}
add_action('bp_compliments_after_remove_data', 'compliments_delete_activity_for_user');
add_action('bp_compliments_after_remove_data', 'compliments_delete_activity_for_user');

/**
* Compliment activity collapses two filters into one
*
* @since 0.0.8
* @package BuddyPress_Compliments
*
* @param array $filters Array of filter options for the given context, in the following format: $option_value => $option_name.
* @param string $context Context for the filter. 'activity', 'member', 'member_groups', 'group'.
*
* @return array
*/
function compliments_merge_filter( $filters, $context ){
if (array_key_exists('compliment_sent', $filters) && array_key_exists('compliment_received', $filters)) {
$label = $filters['compliment_sent'];
unset($filters['compliment_sent']);
unset($filters['compliment_received']);
$filters['compliment_sent,compliment_received'] = $label;
}
return $filters;
}
add_filter('bp_get_activity_show_filters_options', 'compliments_merge_filter', 10, 2);

0 comments on commit f3289c2

Please sign in to comment.