diff --git a/bp-compliments-core.php b/bp-compliments-core.php index ab40e5b..a63c465 100644 --- a/bp-compliments-core.php +++ b/bp-compliments-core.php @@ -63,6 +63,12 @@ public function __construct() { * @package BuddyPress_Compliments */ public function includes( $includes = array() ) { + $bp_compliment_enable_activity_value = esc_attr( get_option('bp_compliment_enable_activity')); + $bp_compliment_enable_activity = $bp_compliment_enable_activity_value ? $bp_compliment_enable_activity_value : 'yes'; + + $bp_compliment_enable_notifications_value = esc_attr( get_option('bp_compliment_enable_notifications')); + $bp_compliment_enable_notifications = $bp_compliment_enable_notifications_value ? $bp_compliment_enable_notifications_value : 'yes'; + // Include the Class that interact with the custom db table. require( $this->path . '/bp-compliments-classes.php' ); // Functions related to compliment component. @@ -74,9 +80,13 @@ public function includes( $includes = array() ) { // Functions related to handling user submitted data and actions. require( $this->path . '/bp-compliments-actions.php' ); // Functions related to notification component. - require( $this->path . '/bp-compliments-notifications.php' ); + if ($bp_compliment_enable_notifications == 'yes') { + require( $this->path . '/bp-compliments-notifications.php' ); + } // Functions related to activity component. - require( $this->path . '/bp-compliments-activity.php' ); + if ($bp_compliment_enable_activity == 'yes') { + require( $this->path . '/bp-compliments-activity.php' ); + } // Functions related to compliment forms. require( $this->path . '/bp-compliments-forms.php' ); // Functions related to compliment settings. diff --git a/change_log.txt b/change_log.txt index 7187db4..fb12f8c 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,10 @@ +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 diff --git a/includes/bp-compliments-forms.php b/includes/bp-compliments-forms.php index a979bd1..2a2b271 100644 --- a/includes/bp-compliments-forms.php +++ b/includes/bp-compliments-forms.php @@ -55,7 +55,7 @@ function bp_compliments_modal_form($pid = 0, $receiver_id = 0) { echo ''; ?> - + diff --git a/includes/bp-compliments-settings.php b/includes/bp-compliments-settings.php index 170ca08..1adc1d3 100644 --- a/includes/bp-compliments-settings.php +++ b/includes/bp-compliments-settings.php @@ -26,6 +26,8 @@ function bp_compliments_register_settings() { register_setting( 'bp-compliment-settings', 'bp_compliment_slug' ); register_setting( 'bp-compliment-settings', 'bp_compliment_can_see_others_comp' ); register_setting( 'bp-compliment-settings', 'bp_compliment_can_delete' ); + register_setting( 'bp-compliment-settings', 'bp_compliment_enable_activity' ); + register_setting( 'bp-compliment-settings', 'bp_compliment_enable_notifications' ); register_setting( 'bp-compliment-settings', 'bp_comp_per_page' ); register_setting( 'bp-compliment-settings', 'bp_comp_custom_css' ); } @@ -44,6 +46,12 @@ function bp_compliments_settings_page() { $bp_compliment_can_delete_value = esc_attr( get_option('bp_compliment_can_delete')); $bp_compliment_can_delete = $bp_compliment_can_delete_value ? $bp_compliment_can_delete_value : 'yes'; + $bp_compliment_enable_activity_value = esc_attr( get_option('bp_compliment_enable_activity')); + $bp_compliment_enable_activity = $bp_compliment_enable_activity_value ? $bp_compliment_enable_activity_value : 'yes'; + + $bp_compliment_enable_notifications_value = esc_attr( get_option('bp_compliment_enable_notifications')); + $bp_compliment_enable_notifications = $bp_compliment_enable_notifications_value ? $bp_compliment_enable_notifications_value : 'yes'; + $comp_per_page_value = esc_attr( get_option('bp_comp_per_page')); $comp_per_page = $comp_per_page_value ? (int) $comp_per_page_value : 5; @@ -52,15 +60,15 @@ function bp_compliments_settings_page() { ?>
+ | ||
---|---|---|
+ | ||
+ | ||
+ | + + | +|
+ | + + | +|
diff --git a/languages/bp-compliments-en_US.mo b/languages/bp-compliments-en_US.mo index bb4afc0..147ee53 100644 Binary files a/languages/bp-compliments-en_US.mo and b/languages/bp-compliments-en_US.mo differ diff --git a/languages/bp-compliments-en_US.po b/languages/bp-compliments-en_US.po index 18aaebd..ae2f559 100644 --- a/languages/bp-compliments-en_US.po +++ b/languages/bp-compliments-en_US.po @@ -1,15 +1,15 @@ msgid "" msgstr "" "Project-Id-Version: BuddyPress Compliments 0.0.6\n" -"POT-Creation-Date: 2015-08-19 18:11-0000\n" -"PO-Revision-Date: 2015-08-19 18:11-0000\n" +"POT-Creation-Date: 2015-08-22 22:07+0530\n" +"PO-Revision-Date: 2015-08-22 22:07+0530\n" "Last-Translator: \n" "Language-Team: GeoDirectory |