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

404 error while sending compliments - FIXED #12

Merged
merged 2 commits into from
Aug 1, 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
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