From 639e9b9cb3ddb38be803b6848647bc199f798893 Mon Sep 17 00:00:00 2001 From: Giri Date: Sat, 22 Aug 2015 22:05:21 +0530 Subject: [PATCH 1/3] Settings added to enable/disable components --- bp-compliments-core.php | 14 ++++++++++-- change_log.txt | 5 +++++ includes/bp-compliments-forms.php | 2 +- includes/bp-compliments-settings.php | 32 +++++++++++++++++++++++++--- 4 files changed, 47 insertions(+), 6 deletions(-) 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..9b415b3 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,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 + v0.0.7 Compliments can be renamed to anything Ex: "Gifts" - ADDED 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() { ?> - + - + - + @@ -81,6 +89,24 @@ function bp_compliments_settings_page() { + + + + + + + + From caff501fd54dee8cba582ef49ea2a6995127d1a9 Mon Sep 17 00:00:00 2001 From: Giri Date: Sat, 22 Aug 2015 22:08:01 +0530 Subject: [PATCH 2/3] traslation updated --- languages/bp-compliments-en_US.mo | Bin 522 -> 522 bytes languages/bp-compliments-en_US.po | 54 ++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/languages/bp-compliments-en_US.mo b/languages/bp-compliments-en_US.mo index bb4afc0c6d9badf900e15e9fd4aa4f803c774c87..147ee5343c3b52b12476d4e71565464763fd3885 100644 GIT binary patch delta 46 pcmeBT>0+7C%41}tU}R)vV6JUoYCLhG3@U%;DP{{j!^v%oEdUf33~T@Z delta 46 pcmeBT>0+7C%42A$U}#}wXsByoU@&o_3@U%;DQ0s$)5&d&EdUg{3~vAc 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 \n" "Language: en_US\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.7.5\n" +"X-Generator: Poedit 1.8.1\n" "X-Poedit-Basepath: ../\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-KeywordsList: __;_e;_n:1,2;_x\n" @@ -70,6 +70,10 @@ msgstr "" msgid "Choose Your %s Type:" msgstr "" +#: includes/bp-compliments-forms.php:58 +msgid "Type your message here" +msgstr "" + #: includes/bp-compliments-forms.php:63 msgid "Send" msgstr "" @@ -103,14 +107,18 @@ msgid "" msgstr "" #: includes/bp-compliments-notifications.php:278 -#: includes/bp-compliments-settings.php:70 -#: includes/bp-compliments-settings.php:79 +#: includes/bp-compliments-settings.php:78 +#: includes/bp-compliments-settings.php:87 +#: includes/bp-compliments-settings.php:96 +#: includes/bp-compliments-settings.php:105 msgid "Yes" msgstr "" #: includes/bp-compliments-notifications.php:279 -#: includes/bp-compliments-settings.php:71 -#: includes/bp-compliments-settings.php:80 +#: includes/bp-compliments-settings.php:79 +#: includes/bp-compliments-settings.php:88 +#: includes/bp-compliments-settings.php:97 +#: includes/bp-compliments-settings.php:106 msgid "No" msgstr "" @@ -119,39 +127,49 @@ msgstr "" msgid "A member sends you a %s" msgstr "" -#: includes/bp-compliments-settings.php:36 +#: includes/bp-compliments-settings.php:38 #, php-format msgid "BuddyPress %s - Settings" msgstr "" -#: includes/bp-compliments-settings.php:55 -msgid "Singlular name ( Ex: Gift. Default: Compliment )" +#: includes/bp-compliments-settings.php:63 +msgid "Singlular name ( e.g. Gift. Default: Compliment )" msgstr "" -#: includes/bp-compliments-settings.php:59 -msgid "Plural name ( Ex: Gifts. Default: Compliments )" +#: includes/bp-compliments-settings.php:67 +msgid "Plural name ( e.g. Gifts. Default: Compliments )" msgstr "" -#: includes/bp-compliments-settings.php:63 -msgid "Slug ( Ex: gifts. Default: compliments. must be lowercase )" +#: includes/bp-compliments-settings.php:71 +msgid "Slug ( e.g. gifts. Default: compliments. must be lowercase )" msgstr "" -#: includes/bp-compliments-settings.php:67 +#: includes/bp-compliments-settings.php:75 #, php-format msgid "Members can see other members %s page?" msgstr "" -#: includes/bp-compliments-settings.php:76 +#: includes/bp-compliments-settings.php:84 #, php-format msgid "Members can delete %s received?" msgstr "" -#: includes/bp-compliments-settings.php:85 +#: includes/bp-compliments-settings.php:93 +#, php-format +msgid "Enable activity component for %s ?" +msgstr "" + +#: includes/bp-compliments-settings.php:102 +#, php-format +msgid "Enable notification component for %s ?" +msgstr "" + +#: includes/bp-compliments-settings.php:111 #, php-format msgid "Number of %s to display per page?" msgstr "" -#: includes/bp-compliments-settings.php:89 +#: includes/bp-compliments-settings.php:115 msgid "Custom CSS styles" msgstr "" From f3289c23787f5834845ce787a0297c66013c6fd5 Mon Sep 17 00:00:00 2001 From: Giri Date: Tue, 25 Aug 2015 18:48:21 +0530 Subject: [PATCH 3/3] Compliments in activity dropdown filter is ambiguous - FIXED --- change_log.txt | 2 ++ includes/bp-compliments-activity.php | 28 +++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) 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
+ +
+ +