Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $bp;
- if(!is_user_logged_in()) :
- bp_core_add_message( __('You must be logged in to post a comment', 'buddypress' ), 'error');
- else :
- if(!check_admin_referer('new_activity_comment', '_wpnonce_new_activity_comment')) :
- bp_core_add_message(__('There was an error posting that reply, please try again.', 'buddypress' ), 'error');
- else :
- $activity_id = apply_filters('bp_activity_post_comment_activity_id', $_POST['comment_form_id']);
- $content = apply_filters('bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id]);
- $comment_id = bp_activity_new_comment(array(
- 'content' => $content,
- 'activity_id' => $activity_id,
- 'parent_id' => $parent_id));
- if(empty($content)) :
- bp_core_add_message(__('Please add a comment.', 'buddypress' ), 'error');
- bp_core_redirect(wp_get_referer() . '#ac-form-' . $activity_id);
- endif;
- if(empty($comment_id)) :
- bp_core_add_message(__('There was an error posting that reply, please try again.', 'buddypress' ), 'error');
- bp_core_redirect(wp_get_referer() . '#ac-form-' . $activity_id);
- else :
- bp_core_add_message(__('Comment posted successfully', 'buddypress'));
- bp_core_redirect(wp_get_referer() . '#ac-form-' . $activity_id);
- endif;
- endif;
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement