diff --git a/change_log.txt b/change_log.txt index 9b415b3..fb12f8c 100644 --- a/change_log.txt +++ b/change_log.txt @@ -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 diff --git a/includes/bp-compliments-activity.php b/includes/bp-compliments-activity.php index 7687648..f8e0f6e 100644 --- a/includes/bp-compliments-activity.php +++ b/includes/bp-compliments-activity.php @@ -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'; } @@ -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'; } @@ -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'); \ No newline at end of file +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); \ No newline at end of file