Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/09/2017 08:35:52 PM (8 years ago)
Author:
r-a-y
Message:

Activity: Fix activity comment deletion when comment ID equals 0.

In #7394, non-existent activity ID lookups now default to zero, instead of
the ID that was passed. For example, $a = new BP_Activity_Activity( 99 ),
$a->id now equals 0 instead of 99.

This is logistically correct; however, this raised a bug with
bp_activity_delete_comment() when passing 0 as the comment ID, which
could potentially delete all activity comments in the database.

Props Maniou.

Fixes #7450 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-functions.php

    r11447 r11583  
    29642964    }
    29652965
     2966    // Check if comment still exists.
     2967    $comment = new BP_Activity_Activity( $comment_id );
     2968    if ( empty( $comment->id ) ) {
     2969        return false;
     2970    }
     2971
    29662972    // Delete any children of this comment.
    29672973    bp_activity_delete_children( $activity_id, $comment_id );
     
    30043010     */
    30053011    function bp_activity_delete_children( $activity_id, $comment_id ) {
     3012        // Check if comment still exists.
     3013        $comment = new BP_Activity_Activity( $comment_id );
     3014        if ( empty( $comment->id ) ) {
     3015            return;
     3016        }
    30063017
    30073018        // Get activity children to delete.
Note: See TracChangeset for help on using the changeset viewer.