diff --git src/bp-activity/actions/reply.php src/bp-activity/actions/reply.php
index 4a42d943a..b34d8f312 100644
|
|
|
15 | 15 | * @return bool False on failure. |
16 | 16 | */ |
17 | 17 | function bp_activity_action_post_comment() { |
18 | | if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'reply' ) ) |
| 18 | if ( ! is_user_logged_in() || ! bp_is_activity_component() || ! bp_is_current_action( 'reply' ) ) { |
19 | 19 | return false; |
| 20 | } |
| 21 | |
| 22 | if ( ! isset( $_POST['comment_form_id'] ) ) { |
| 23 | return false; |
| 24 | } |
| 25 | |
| 26 | $activity_id = absint( wp_unslash( $_POST['comment_form_id'] ) ); |
| 27 | |
| 28 | if ( ! isset( $activity_id ) ) { |
| 29 | return false; |
| 30 | } |
20 | 31 | |
21 | 32 | // Check the nonce. |
22 | | check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' ); |
| 33 | check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment_' . $activity_id ); |
23 | 34 | |
24 | 35 | /** |
25 | 36 | * Filters the activity ID a comment will be in reply to. |
26 | 37 | * |
27 | 38 | * @since 1.2.0 |
28 | 39 | * |
29 | | * @param string $value ID of the activity being replied to. |
| 40 | * @param string $activity_id ID of the activity being replied to. |
30 | 41 | */ |
31 | | $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] ); |
| 42 | $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $activity_id ); |
32 | 43 | |
33 | 44 | /** |
34 | 45 | * Filters the comment content for a comment reply. |
… |
… |
function bp_activity_action_post_comment() { |
50 | 61 | bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id ); |
51 | 62 | } |
52 | 63 | |
53 | | $comment_id = bp_activity_new_comment( array( |
54 | | 'content' => $content, |
55 | | 'activity_id' => $activity_id, |
56 | | 'parent_id' => false |
57 | | )); |
| 64 | $comment_id = bp_activity_new_comment( |
| 65 | array( |
| 66 | 'content' => $content, |
| 67 | 'activity_id' => $activity_id, |
| 68 | 'parent_id' => false |
| 69 | ) |
| 70 | ); |
58 | 71 | |
59 | | if ( !empty( $comment_id ) ) |
| 72 | if ( ! empty( $comment_id ) ) { |
60 | 73 | bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) ); |
61 | | else |
| 74 | } else { |
62 | 75 | bp_core_add_message( __( 'There was an error posting that reply. Please try again.', 'buddypress' ), 'error' ); |
| 76 | } |
63 | 77 | |
64 | 78 | bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id ); |
65 | 79 | } |
66 | | add_action( 'bp_actions', 'bp_activity_action_post_comment' ); |
67 | | No newline at end of file |
| 80 | add_action( 'bp_actions', 'bp_activity_action_post_comment' ); |