BuddyBoss Home – Web › Support Forums › Plugins › BuddyBoss Wall › Unable to delete other people's posts on my wall
- This topic has 4 replies, 2 contibutors, and was last updated 9 years, 10 months ago by Alyssa.
Question
January 20, 2015 at 12:27 pm #34891@igrewupingmailIf somebody post something on my wall I am unable to delete? I have the option to delete things that I have posted, but no option to delete anything posted by someone else on my wall.
Answers
January 20, 2015 at 2:36 pm #34895@alyssa-buddyboss
AlyssaParticipant@igrewupingmail that is correct, you are unable to delete posts by other people on your wall. This is on the to do list. Do you need to be able to delete individual comments, entire posts or both?
January 20, 2015 at 3:35 pm #34897@igrewupingmailI would think both, user should have complete control over what is on their wall.
January 20, 2015 at 6:39 pm #34903@alyssa-buddyboss
AlyssaParticipant@igrewupingmail I will add this to the developers to do list.
January 20, 2015 at 6:56 pm #34904@alyssa-buddyboss
AlyssaParticipant@igrewupingmail all credit given to buddydev
http://buddydev.com/buddypress/allow-activity-authors-delete-activity-comments-users-buddypress-based-social-network/
for this code:add_filter( 'bp_activity_user_can_delete', 'buddydev_activity_user_can_delete', 10, 2 ); function buddydev_activity_user_can_delete( $can_delete, $activity ) { //if the user already has permission //or the user is not logged in, we don't care if( $can_delete || ! is_user_logged_in() ) return $can_delete ; //if we are here, let us check if the current user is the author of the parent activity $parent_activity = null; //if it is an activity comment if( $activity->item_id ) { $parent_activity = new BP_Activity_Activity( $activity->item_id ); } else { $parent_activity = $activity; } //if the current user is author of main activity, he/she can delete it if( $parent_activity->user_id == get_current_user_id() ) $can_delete = true; if( bp_loggedin_user_id() == bp_displayed_user_id() ) $can_delete = true; return $can_delete; } //hook to ajax comment delete action add_action( 'wp_ajax_delete_activity_comment', 'buddydev_ajax_delete_activity_comment', 0 ); //we have increased our priority to make sure that our handler gets called first function buddydev_ajax_delete_activity_comment() { // Bail if not a POST action if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) return; // Check the nonce check_admin_referer( 'bp_activity_delete_link' ); if ( ! is_user_logged_in() ) exit( '-1' ); $comment = new BP_Activity_Activity( $_POST['id'] ); if ( ! bp_activity_user_can_delete( $comment ) ) return false; //let others handle it // Call the action before the delete so plugins can still fetch information about it do_action( 'bp_activity_before_action_delete_activity', $_POST['id'], $comment->user_id ); if ( ! bp_activity_delete_comment( $comment->item_id, $comment->id ) ) exit( '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>' ); do_action( 'bp_activity_action_delete_activity', $_POST['id'], $comment->user_id ); exit; }
- The question ‘Unable to delete other people's posts on my wall’ is closed to new replies.