diff --git a/bp-compliments-core.php b/bp-compliments-core.php
index 5cf1e2b..f46696f 100644
--- a/bp-compliments-core.php
+++ b/bp-compliments-core.php
@@ -180,6 +180,12 @@ public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
$bp_compliment_can_see_others_comp = $bp_compliment_can_see_others_comp_value ? $bp_compliment_can_see_others_comp_value : 'yes';
if ($bp_compliment_can_see_others_comp == 'yes') {
$show_for_displayed_user = true;
+ } elseif ($bp_compliment_can_see_others_comp == 'members_only') {
+ if (is_user_logged_in()) {
+ $show_for_displayed_user = true;
+ } else {
+ $show_for_displayed_user = false;
+ }
} else {
$show_for_displayed_user = false;
}
@@ -214,16 +220,6 @@ public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
* @package BuddyPress_Compliments
*/
public function enqueue_scripts() {
- // Do not enqueue if no user is logged in
- if ( ! is_user_logged_in() ) {
- return;
- }
-
- // Do not enqueue on multisite if not on multiblog and not on root blog
- if( ! bp_is_multiblog_mode() && ! bp_is_root_blog() ) {
- return;
- }
-
wp_enqueue_script( 'bp-compliments-js', constant( 'BP_COMPLIMENTS_URL' ) . 'js/bp-compliments.js', array( 'jquery' ) );
wp_register_style( 'bp-compliments-css', constant( 'BP_COMPLIMENTS_URL' ) . 'css/bp-compliments.css' );
wp_enqueue_style( 'bp-compliments-css' );
diff --git a/change_log.txt b/change_log.txt
index ee09bb8..9ccc6df 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -2,6 +2,7 @@ v0.0.9
Changed textdomain from defined constant to a string - CHANGED
Added filters and actions for whoop theme compatibility - ADDED
Notification not showing properly - FIXED
+Added support for member only compliment display - ADDED
v0.0.8
Option added to enable/disable activity component - ADDED
diff --git a/includes/bp-compliments-actions.php b/includes/bp-compliments-actions.php
index ca3e1bf..358ff08 100644
--- a/includes/bp-compliments-actions.php
+++ b/includes/bp-compliments-actions.php
@@ -57,9 +57,15 @@ function handle_compliments_form_data() {
$bp_compliment_can_see_others_comp = $bp_compliment_can_see_others_comp_value ? $bp_compliment_can_see_others_comp_value : 'yes';
if ($bp_compliment_can_see_others_comp == 'yes') {
$show_for_displayed_user = true;
- } else {
- $show_for_displayed_user = false;
- }
+ } elseif ($bp_compliment_can_see_others_comp == 'members_only') {
+ if (is_user_logged_in()) {
+ $show_for_displayed_user = true;
+ } else {
+ $show_for_displayed_user = false;
+ }
+ } else {
+ $show_for_displayed_user = false;
+ }
if (current_user_can( 'manage_options' )) {
$show_for_displayed_user = true;
diff --git a/includes/bp-compliments-activity.php b/includes/bp-compliments-activity.php
index a1e6543..47f2b83 100644
--- a/includes/bp-compliments-activity.php
+++ b/includes/bp-compliments-activity.php
@@ -156,6 +156,12 @@ function compliments_format_activity_action_compliment_received( $action, $activ
if ($bp_compliment_can_see_others_comp == 'yes') {
$action = sprintf( __( '%1$s has received a %2$s from %3$s', 'bp-compliments' ), $receiver_link, $compliment_link, $sender_link );
+ } elseif ($bp_compliment_can_see_others_comp == 'members_only') {
+ if (is_user_logged_in()) {
+ $action = sprintf( __( '%1$s has received a %2$s from %3$s', 'bp-compliments' ), $receiver_link, $compliment_link, $sender_link );
+ } else {
+ $action = sprintf( __( '%1$s has received a %2$s from %3$s', 'bp-compliments' ), $receiver_link, strtolower(BP_COMP_SINGULAR_NAME), $sender_link );
+ }
} else {
$action = sprintf( __( '%1$s has received a %2$s from %3$s', 'bp-compliments' ), $receiver_link, strtolower(BP_COMP_SINGULAR_NAME), $sender_link );
}
@@ -200,6 +206,12 @@ function compliments_format_activity_action_compliment_sent( $action, $activity
if ($bp_compliment_can_see_others_comp == 'yes') {
$action = sprintf( __( '%1$s has sent a %2$s to %3$s', 'bp-compliments' ), $sender_link, $compliment_link, $receiver_link );
+ } elseif ($bp_compliment_can_see_others_comp == 'members_only') {
+ if (is_user_logged_in()) {
+ $action = sprintf( __( '%1$s has sent a %2$s to %3$s', 'bp-compliments' ), $sender_link, $compliment_link, $receiver_link );
+ } else {
+ $action = sprintf( __( '%1$s has sent a %2$s to %3$s', 'bp-compliments' ), $sender_link, strtolower(BP_COMP_SINGULAR_NAME), $receiver_link );
+ }
} else {
$action = sprintf( __( '%1$s has sent a %2$s to %3$s', 'bp-compliments' ), $sender_link, strtolower(BP_COMP_SINGULAR_NAME), $receiver_link );
}
diff --git a/includes/bp-compliments-settings.php b/includes/bp-compliments-settings.php
index 326e756..cfebbf1 100644
--- a/includes/bp-compliments-settings.php
+++ b/includes/bp-compliments-settings.php
@@ -72,11 +72,12 @@ function bp_compliments_settings_page() {
|
- |
+ |
|
diff --git a/includes/templates/buddypress/members/single/compliments.php b/includes/templates/buddypress/members/single/compliments.php
index 8c19ea1..4c8c532 100644
--- a/includes/templates/buddypress/members/single/compliments.php
+++ b/includes/templates/buddypress/members/single/compliments.php
@@ -56,7 +56,7 @@
}
}
- if ($compliments && ($bp_compliment_can_see_others_comp == 'yes')) {
+ if ( ($compliments && $bp_compliment_can_see_others_comp == 'yes') || ( $compliments && is_user_logged_in() && $bp_compliment_can_see_others_comp == 'members_only' )) {
?>
diff --git a/languages/bp-compliments-en_US.mo b/languages/bp-compliments-en_US.mo
index 9cd860e..e2bec5f 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 37d4551..e81e5d2 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.8\n"
-"POT-Creation-Date: 2015-09-03 20:38-0000\n"
-"PO-Revision-Date: 2015-09-03 20:38-0000\n"
+"POT-Creation-Date: 2015-09-21 13:02+0530\n"
+"PO-Revision-Date: 2015-09-21 13:02+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"
@@ -54,13 +54,17 @@ msgid "%s Sent"
msgstr ""
#: includes/bp-compliments-activity.php:158
-#: includes/bp-compliments-activity.php:160
+#: includes/bp-compliments-activity.php:161
+#: includes/bp-compliments-activity.php:163
+#: includes/bp-compliments-activity.php:166
#, php-format
msgid "%1$s has received a %2$s from %3$s"
msgstr ""
-#: includes/bp-compliments-activity.php:202
-#: includes/bp-compliments-activity.php:204
+#: includes/bp-compliments-activity.php:208
+#: includes/bp-compliments-activity.php:211
+#: includes/bp-compliments-activity.php:213
+#: includes/bp-compliments-activity.php:216
#, php-format
msgid "%1$s has sent a %2$s to %3$s"
msgstr ""
@@ -83,12 +87,12 @@ msgid "Cancel"
msgstr ""
#: includes/bp-compliments-notifications.php:49
-#: includes/bp-compliments-notifications.php:185
+#: includes/bp-compliments-notifications.php:188
#, php-format
msgid "%s has sent you a %s"
msgstr ""
-#: includes/bp-compliments-notifications.php:188
+#: includes/bp-compliments-notifications.php:191
#, php-format
msgid ""
"%s has sent you a %s.\n"
@@ -96,7 +100,7 @@ msgid ""
"To view %s's %s: %s"
msgstr ""
-#: includes/bp-compliments-notifications.php:195
+#: includes/bp-compliments-notifications.php:198
#, php-format
msgid ""
"\n"
@@ -106,23 +110,21 @@ msgid ""
"%s"
msgstr ""
-#: includes/bp-compliments-notifications.php:278
-#: 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:79
+#: includes/bp-compliments-notifications.php:281
#: includes/bp-compliments-settings.php:88
#: includes/bp-compliments-settings.php:97
#: includes/bp-compliments-settings.php:106
+msgid "Yes"
+msgstr ""
+
+#: includes/bp-compliments-notifications.php:282
+#: includes/bp-compliments-settings.php:89
+#: includes/bp-compliments-settings.php:98
+#: includes/bp-compliments-settings.php:107
msgid "No"
msgstr ""
-#: includes/bp-compliments-notifications.php:286
+#: includes/bp-compliments-notifications.php:289
#, php-format
msgid "A member sends you a %s"
msgstr ""
@@ -146,30 +148,42 @@ msgstr ""
#: includes/bp-compliments-settings.php:75
#, php-format
-msgid "Members can see other members %s page?"
+msgid "Who can see other members %s page?"
+msgstr ""
+
+#: includes/bp-compliments-settings.php:78
+msgid "Anybody"
+msgstr ""
+
+#: includes/bp-compliments-settings.php:79
+msgid "Nobody"
+msgstr ""
+
+#: includes/bp-compliments-settings.php:80
+msgid "Members Only"
msgstr ""
-#: includes/bp-compliments-settings.php:84
+#: includes/bp-compliments-settings.php:85
#, php-format
msgid "Members can delete %s received?"
msgstr ""
-#: includes/bp-compliments-settings.php:93
+#: includes/bp-compliments-settings.php:94
#, php-format
msgid "Enable activity component for %s ?"
msgstr ""
-#: includes/bp-compliments-settings.php:102
+#: includes/bp-compliments-settings.php:103
#, php-format
msgid "Enable notification component for %s ?"
msgstr ""
-#: includes/bp-compliments-settings.php:111
+#: includes/bp-compliments-settings.php:112
#, php-format
msgid "Number of %s to display per page?"
msgstr ""
-#: includes/bp-compliments-settings.php:115
+#: includes/bp-compliments-settings.php:116
msgid "Custom CSS styles"
msgstr ""
@@ -267,27 +281,27 @@ msgstr ""
msgid "Delete"
msgstr ""
-#: includes/templates/buddypress/members/single/compliments.php:120
+#: includes/templates/buddypress/members/single/compliments.php:122
#, php-format
msgid "1 of 1"
msgid_plural "%1$s to %2$s of %3$s"
msgstr[0] ""
msgstr[1] ""
-#: includes/templates/buddypress/members/single/compliments.php:123
+#: includes/templates/buddypress/members/single/compliments.php:125
msgid "Go to Page"
msgstr ""
-#: includes/templates/buddypress/members/single/compliments.php:139
+#: includes/templates/buddypress/members/single/compliments.php:141
msgid "You don't have permission to access this page."
msgstr ""
-#: includes/templates/buddypress/members/single/compliments.php:146
+#: includes/templates/buddypress/members/single/compliments.php:148
#, php-format
msgid "Aw, you have no %1$s yet. To get some try sending %1$s to others."
msgstr ""
-#: includes/templates/buddypress/members/single/compliments.php:152
+#: includes/templates/buddypress/members/single/compliments.php:154
#, php-format
msgid "Sorry, no %1$s just yet."
msgstr ""