[buddypress-trac] [BuddyPress Trac] #7450: Problem deleting comment activities

buddypress-trac noreply at wordpress.org
Sat Feb 25 14:27:59 UTC 2017


#7450: Problem deleting comment activities
--------------------------+-----------------------------
 Reporter:  Maniou        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  highest       |  Milestone:  Awaiting Review
Component:  Activity      |    Version:  2.8.0
 Severity:  critical      |   Keywords:  needs-patch
--------------------------+-----------------------------
 Hello,

 First i'm not a dev and my english is not perfect but i'm going to explain
 the best i can the problem since the last maj 2.8.1.

 The problem : when i'm trying to detele a comment activity that doesn't
 exist, it's deleting from the database all the comments with type =
 "activity_comment".

 On the activity feed when I press the "delete" button if this activity
 have been already (for example another browser instance) it's going to
 delete all the activity_comment from the database (just before an error
 output).

 When deleting an activity that doesn't exist, this is what happen :

 '''File : /buddypress/bp-templates/bp-legacy/buddypress-functions.php
 Function : bp_legacy_theme_delete_activity_comment()'''


 {{{
 $_POST['id'] = my id that doesn't exist
 }}}



 {{{
 $comment = new BP_Activity_Activity( $_POST['id'] );
 }}}


 $comment output is equal to :

 {{{
 BP_Activity_Activity Object
 (
     [id] => 0
     [item_id] =>
     [secondary_item_id] =>
     [user_id] =>
     [primary_link] =>
     [component] =>
     [type] =>
     [action] =>
     [content] =>
     [date_recorded] =>
     [hide_sitewide] => 0
     [mptt_left] =>
     [mptt_right] =>
     [is_spam] =>
     [errors] => WP_Error Object
         (
             [errors] => Array
                 (
                 )

             [error_data] => Array
                 (
                 )

         )

     [error_type] => bool
 )
 }}}


 There is no check on $comment->id = 0 in order to exit.

 I have to add this code to fix the problem, but i guess it's not the best
 way to do it :


 {{{
         if ($comment->id == 0)
                 exit( '-1<div id="message" class="error bp-ajax-
 message"><p>' . __( 'Comment doesn\'t exist.', 'buddypress' ) .
 '</p></div>' );
 }}}


 Also, i don't know if it's related but i didn't find any reference to
 "wp_ajax_delete_activity_comment" in the 2.8.1 version.

 Thank you,

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7450>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list