Skip to content

Commit

Permalink
Merge pull request #7 from GeoDirectory/master
Browse files Browse the repository at this point in the history
Merge from master
  • Loading branch information
kprajapatii committed Nov 17, 2015
2 parents fb3c5a4 + 9fa436e commit 8cf4b46
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
2 changes: 2 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
v1.0.1
Use singular name instead of slug name - FIXED
Admin can delete compliments - ADDED
404 page when deleting compliments - FIXED

v1.0.0
Compliment message uses slug name instead of singular name - FIXED
Expand Down
10 changes: 8 additions & 2 deletions includes/bp-compliments-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ function delete_single_complement() {
return;
}

if ( bp_displayed_user_id() != bp_loggedin_user_id() ) {
return;
if (!current_user_can( 'manage_options' )) {
if ( bp_displayed_user_id() != bp_loggedin_user_id() ) {
return;
}
}

if (!isset($_GET['c_id']) OR !isset($_GET['action']) ) {
Expand All @@ -104,6 +106,10 @@ function delete_single_complement() {
$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';

if (current_user_can( 'manage_options' )) {
$bp_compliment_can_delete = 'yes';
}

if ($bp_compliment_can_delete == 'no') {
return;
}
Expand Down
9 changes: 7 additions & 2 deletions includes/templates/buddypress/members/single/compliments.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ class='preview-upload'/>
global $bp;
$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';
if (is_user_logged_in() && ($bp->loggedin_user->id == $bp->displayed_user->id) && ($bp_compliment_can_delete != 'no')) {

if (current_user_can( 'manage_options' )) {
$bp_compliment_can_delete = 'yes';
}

if (is_user_logged_in() && (($bp->loggedin_user->id == $bp->displayed_user->id) || current_user_can( 'manage_options' )) && ($bp_compliment_can_delete == 'yes')) {
$receiver_url = bp_core_get_userlink( $comp->receiver_id, false, true );
$compliment_url = $receiver_url . $bp->compliments->id . '/?c_id='.$comp->id.'&action=delete';
$compliment_url = $receiver_url . BP_COMPLIMENTS_SLUG . '/?c_id='.$comp->id.'&action=delete';
?>
<a href="<?php echo $compliment_url; ?>" class="button item-button confirm" style="float: right;"><?php echo __('Delete', 'bp-compliments'); ?></a>
<?php } ?>
Expand Down
Binary file modified languages/bp-compliments-en_US.mo
Binary file not shown.
16 changes: 8 additions & 8 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 1.0.1\n"
"POT-Creation-Date: 2015-11-09 20:08-0000\n"
"PO-Revision-Date: 2015-11-09 20:08-0000\n"
"POT-Creation-Date: 2015-11-10 15:37-0000\n"
"PO-Revision-Date: 2015-11-10 15:37-0000\n"
"Last-Translator: \n"
"Language-Team: GeoDirectory <[email protected]>\n"
"Language: en_US\n"
Expand Down Expand Up @@ -277,31 +277,31 @@ msgstr ""
msgid "Send %s"
msgstr ""

#: includes/templates/buddypress/members/single/compliments.php:88
#: includes/templates/buddypress/members/single/compliments.php:93
msgid "Delete"
msgstr ""

#: includes/templates/buddypress/members/single/compliments.php:122
#: includes/templates/buddypress/members/single/compliments.php:127
#, 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:125
#: includes/templates/buddypress/members/single/compliments.php:130
msgid "Go to Page"
msgstr ""

#: includes/templates/buddypress/members/single/compliments.php:141
#: includes/templates/buddypress/members/single/compliments.php:146
msgid "You don't have permission to access this page."
msgstr ""

#: includes/templates/buddypress/members/single/compliments.php:148
#: includes/templates/buddypress/members/single/compliments.php:153
#, 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:154
#: includes/templates/buddypress/members/single/compliments.php:159
#, php-format
msgid "Sorry, no %1$s just yet."
msgstr ""

0 comments on commit 8cf4b46

Please sign in to comment.