Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from master #7

Merged
merged 3 commits into from
Nov 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ""