Skip to:
Content

BuddyPress.org

Changeset 6732


Ignore:
Timestamp:
01/19/2013 03:40:28 AM (13 years ago)
Author:
boonebgorges
Message:

Allow activity items to be deleted when the user_id key is empty

Some plugins create activity items that are not attached to a specific user_id.
The activity deletion request handlers (AJAX and bp-activity-actions) prevent
deletion of activity items when the item's user_id value is empty. This
changeset moves this security measure to the bp_activity_user_can_delete()
function, so that anonymous activity items can still be deleted by item admins.

Props magnus78

Fixes #4735

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-actions.php

    r6342 r6732  
    148148
    149149    // Check access
    150     if ( empty( $activity->user_id ) || !bp_activity_user_can_delete( $activity ) )
     150    if ( ! bp_activity_user_can_delete( $activity ) )
    151151        return false;
    152152
  • trunk/bp-activity/bp-activity-template.php

    r6684 r6732  
    13571357        $can_delete = true;
    13581358
    1359     if ( $activity->user_id == bp_loggedin_user_id() )
     1359    if ( is_user_logged_in() && $activity->user_id == bp_loggedin_user_id() )
    13601360        $can_delete = true;
    13611361
  • trunk/bp-templates/bp-legacy/buddypress-functions.php

    r6679 r6732  
    618618
    619619    // Check access
    620     if ( empty( $activity->user_id ) || ! bp_activity_user_can_delete( $activity ) )
     620    if ( ! bp_activity_user_can_delete( $activity ) )
    621621        exit( '-1' );
    622622
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r6408 r6732  
    371371
    372372    // Check access
    373     if ( empty( $activity->user_id ) || ! bp_activity_user_can_delete( $activity ) )
     373    if ( ! bp_activity_user_can_delete( $activity ) )
    374374        exit( '-1' );
    375375
Note: See TracChangeset for help on using the changeset viewer.