Skip to content

Commit

Permalink
404 error while sending compliments - FIXED
Browse files Browse the repository at this point in the history
  • Loading branch information
viruthagiri committed Aug 1, 2015
1 parent 5d06d84 commit 54b47d1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v0.0.5
404 error while sending compliments - FIXED

v0.0.4
Members can see other members compliment page? setting - ADDED

Expand Down
20 changes: 19 additions & 1 deletion includes/bp-compliments-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function handle_compliments_form_data() {
}

$receiver_name = bp_core_get_user_displayname($receiver_id);

$redirect_url = bp_core_get_user_domain($receiver_id);

if ( ! bp_compliments_start_compliment($args)) {
Expand All @@ -52,7 +53,24 @@ function handle_compliments_form_data() {
bp_core_add_message( sprintf( __( 'Your compliment sent to %s.', BP_COMP_TEXTDOMAIN ), $receiver_name ) );
}

$redirect = $redirect_url.'compliments/';
$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;
}

if (current_user_can( 'manage_options' )) {
$show_for_displayed_user = true;
}

if ($show_for_displayed_user) {
$redirect = $redirect_url.'compliments/';
} else {
$redirect = $redirect_url;
}

bp_core_redirect( $redirect );
}
}
Expand Down
3 changes: 3 additions & 0 deletions includes/bp-compliments-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* @param int $receiver_id Compliment receiver ID.
*/
function bp_compliments_modal_form($pid = 0, $receiver_id = 0) {
if (!$receiver_id && bp_displayed_user_id()) {
$receiver_id = bp_displayed_user_id();
}
?>
<div class="comp-modal">
<div class="comp-modal-content-wrap">
Expand Down
2 changes: 2 additions & 0 deletions includes/templates/buddypress/members/single/compliments.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
$bp_compliment_can_see_others_comp = $bp_compliment_can_see_others_comp_value ? $bp_compliment_can_see_others_comp_value : 'yes';
if (bp_displayed_user_id() == bp_loggedin_user_id()) {
$bp_compliment_can_see_others_comp = 'yes';
} elseif (current_user_can( 'manage_options' )) {
$bp_compliment_can_see_others_comp = 'yes';
}

$page = isset($_GET['cpage']) ? abs((int)$_GET['cpage']) : 1;
Expand Down

0 comments on commit 54b47d1

Please sign in to comment.