Advertisement
Guest User

reply.php BuddyPress

a guest
Feb 2nd, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2. global $bp;
  3.  
  4. if(!is_user_logged_in()) :
  5.  
  6. bp_core_add_message( __('You must be logged in to post a comment', 'buddypress' ), 'error');
  7.  
  8. else :
  9.  
  10. if(!check_admin_referer('new_activity_comment', '_wpnonce_new_activity_comment')) :
  11.  
  12. bp_core_add_message(__('There was an error posting that reply, please try again.', 'buddypress' ), 'error');
  13.  
  14. else :
  15.  
  16. $activity_id = apply_filters('bp_activity_post_comment_activity_id', $_POST['comment_form_id']);
  17. $content = apply_filters('bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id]);
  18.  
  19. $comment_id = bp_activity_new_comment(array(
  20. 'content' => $content,
  21. 'activity_id' => $activity_id,
  22. 'parent_id' => $parent_id));
  23.  
  24. if(empty($content)) :
  25. bp_core_add_message(__('Please add a comment.', 'buddypress' ), 'error');
  26. bp_core_redirect(wp_get_referer() . '#ac-form-' . $activity_id);
  27. endif;
  28.  
  29. if(empty($comment_id)) :
  30. bp_core_add_message(__('There was an error posting that reply, please try again.', 'buddypress' ), 'error');
  31. bp_core_redirect(wp_get_referer() . '#ac-form-' . $activity_id);
  32. else :
  33. bp_core_add_message(__('Comment posted successfully', 'buddypress'));
  34. bp_core_redirect(wp_get_referer() . '#ac-form-' . $activity_id);
  35. endif;
  36.  
  37. endif;
  38.  
  39. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement