Skip to content

Commit

Permalink
Merge pull request #5 from GeoDirectory/master
Browse files Browse the repository at this point in the history
Merge from master
  • Loading branch information
kprajapatii committed Oct 14, 2015
2 parents d5e8a69 + 9a3597a commit 8b61717
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 57 deletions.
16 changes: 6 additions & 10 deletions bp-compliments-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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' );
Expand Down
4 changes: 2 additions & 2 deletions bp-compliments.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Plugin Name: BuddyPress Compliments
Plugin URI: http://wpgeodirectory.com/
Description: Compliments module for BuddyPress.
Version: 0.0.8
Version: 1.0.0
Author: GeoDirectory
Author URI: http://wpgeodirectory.com
*/
Expand All @@ -19,7 +19,7 @@
if ( !defined( 'ABSPATH' ) ) exit;

// Define the plugin version.
define( 'BP_COMPLIMENTS_VER', '0.0.8' );
define( 'BP_COMPLIMENTS_VER', '1.0.0' );

/**
* BuddyPress compliments text domain.
Expand Down
9 changes: 9 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
v1.0.1
Use singular name instead of slug name - FIXED

v1.0.0
Compliment message uses slug name instead of singular name - FIXED
Send modal form not showing properly in mobile - FIXED


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
Expand Down
7 changes: 4 additions & 3 deletions css/bp-compliments.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@
}
@media only screen and (max-width: 660px) {
.comp-modal {
left: 20%;
left: 11%;
width: 80%;
top: 10%;
}
}
@media only screen and (max-width: 480px) {
.comp-modal {
width: 98%;
left: 1%;
width: 80%;
left: 11%;
top: 10%;
}
}
Expand Down
14 changes: 10 additions & 4 deletions includes/bp-compliments-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,22 @@ function handle_compliments_form_data() {
if ( ! bp_compliments_start_compliment($args)) {
bp_core_add_message( sprintf( __( 'There was a problem when trying to send %s to %s, please contact administrator.', 'bp-compliments' ), strtolower(BP_COMP_SINGULAR_NAME), $receiver_name ), 'error' );
} else {
bp_core_add_message( sprintf( __( 'Your %s sent to %s.', 'bp-compliments' ), strtolower(BP_COMP_SINGULAR_NAME), $receiver_name ) );
bp_core_add_message( sprintf( __( 'Your %s sent to %s.', 'bp-compliments' ), BP_COMP_SINGULAR_NAME, $receiver_name ) );
}

$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_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;
Expand Down
12 changes: 12 additions & 0 deletions includes/bp-compliments-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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 );
}
Expand Down
2 changes: 1 addition & 1 deletion includes/bp-compliments-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function bp_compliments_screen_notification_settings() {
<tbody>
<tr>
<td></td>
<td><?php echo sprintf( __( 'A member sends you a %s', 'bp-compliments' ), strtolower(BP_COMP_SINGULAR_NAME)); ?></td>
<td><?php echo sprintf( __( 'A member sends you a %s', 'bp-compliments' ), BP_COMP_SINGULAR_NAME); ?></td>
<td class="yes"><input type="radio" name="notifications[notification_on_compliments]" value="yes" <?php checked( $notify, 'yes', true ) ?>/></td>
<td class="no"><input type="radio" name="notifications[notification_on_compliments]" value="no" <?php checked( $notify, 'no', true ) ?>/></td>
</tr>
Expand Down
7 changes: 4 additions & 3 deletions includes/bp-compliments-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ function bp_compliments_settings_page() {
<td><input type="text" class="widefat" name="bp_compliment_slug" value="<?php echo BP_COMPLIMENTS_SLUG; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><?php echo sprintf( __( 'Members can see other members %s page?', 'bp-compliments' ), strtolower(BP_COMP_SINGULAR_NAME) ); ?></th>
<th scope="row"><?php echo sprintf( __( 'Who can see other members %s page?', 'bp-compliments' ), strtolower(BP_COMP_SINGULAR_NAME) ); ?></th>
<td>
<select id="bp_compliment_can_see_others_comp" name="bp_compliment_can_see_others_comp">
<option value="yes" <?php selected( $bp_compliment_can_see_others_comp, 'yes' ); ?>><?php echo __( 'Yes', 'bp-compliments' ); ?></option>
<option value="no" <?php selected( $bp_compliment_can_see_others_comp, 'no' ); ?>><?php echo __( 'No', 'bp-compliments' ); ?></option>
<option value="yes" <?php selected( $bp_compliment_can_see_others_comp, 'yes' ); ?>><?php echo __( 'Anybody', 'bp-compliments' ); ?></option>
<option value="no" <?php selected( $bp_compliment_can_see_others_comp, 'no' ); ?>><?php echo __( 'Nobody', 'bp-compliments' ); ?></option>
<option value="members_only" <?php selected( $bp_compliment_can_see_others_comp, 'members_only' ); ?>><?php echo __( 'Members Only', 'bp-compliments' ); ?></option>
</select>
</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions includes/templates/buddypress/members/single/compliments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' )) {
?>
<div class="comp-user-content">
<ul class="comp-user-ul">
Expand Down Expand Up @@ -145,13 +145,13 @@ class='preview-upload'/>
if (bp_displayed_user_id() == bp_loggedin_user_id()) {
?>
<div id="message" class="bp-no-compliments info">
<p><?php echo sprintf( __( 'Aw, you have no %1$s yet. To get some try sending %1$s to others.', 'bp-compliments' ), strtolower(BP_COMP_PLURAL_NAME) ); ?></p>
<p><?php echo sprintf( __( 'Aw, you have no %1$s yet. To get some try sending %1$s to others.', 'bp-compliments' ), BP_COMP_SINGULAR_NAME ); ?></p>
</div>
<?php
} else {
?>
<div id="message" class="bp-no-compliments info">
<p><?php echo sprintf( __( 'Sorry, no %1$s just yet.', 'bp-compliments' ), strtolower(BP_COMP_PLURAL_NAME) ); ?></p>
<p><?php echo sprintf( __( 'Sorry, no %1$s just yet.', 'bp-compliments' ), BP_COMP_PLURAL_NAME ); ?></p>
</div>
<?php
}
Expand Down
Binary file modified languages/bp-compliments-en_US.mo
Binary file not shown.
76 changes: 45 additions & 31 deletions languages/bp-compliments-en_US.po
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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"
"Project-Id-Version: BuddyPress Compliments 1.0.0\n"
"POT-Creation-Date: 2015-09-29 17:02-0000\n"
"PO-Revision-Date: 2015-09-29 17:03-0000\n"
"Last-Translator: \n"
"Language-Team: GeoDirectory <[email protected]>\n"
"Language: en_US\n"
Expand Down Expand Up @@ -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 ""
Expand All @@ -83,20 +87,20 @@ 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"
"\n"
"To view %s's %s: %s"
msgstr ""

#: includes/bp-compliments-notifications.php:195
#: includes/bp-compliments-notifications.php:198
#, php-format
msgid ""
"\n"
Expand All @@ -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 ""
Expand All @@ -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 ""

Expand Down Expand Up @@ -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 ""

0 comments on commit 8b61717

Please sign in to comment.