Skip to:
Content

BuddyPress.org

Changeset 4548


Ignore:
Timestamp:
06/21/2011 07:22:17 PM (14 years ago)
Author:
djpaul
Message:

Fix deleting activity stream items. Fixes #3272

Location:
trunk
Files:
3 edited

Legend:

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

    r4520 r4548  
    100100
    101101    // Check access
    102     if ( !bp_activity_user_can_delete() )
     102    if ( empty( $activity->user_id ) || !bp_activity_user_can_delete( $activity ) )
    103103        return false;
    104104
  • trunk/bp-activity/bp-activity-template.php

    r4515 r4548  
    717717    }
    718718
    719 function bp_activity_user_can_delete() {
     719function bp_activity_user_can_delete( $activity = false ) {
    720720    global $activities_template, $bp;
     721
     722    if ( !$activity )
     723        $activity = $activities_template->activity;
    721724
    722725    $can_delete = false;
     
    725728        $can_delete = true;
    726729
    727     if ( $activities_template->activity->user_id == $bp->loggedin_user->id )
     730    if ( $activity->user_id == $bp->loggedin_user->id )
    728731        $can_delete = true;
    729732
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r4524 r4548  
    241241    }
    242242
    243     if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) )
    244         return false;
     243    if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) ) {
     244        echo '-1';
     245        return false;
     246    }
    245247
    246248    $activity = new BP_Activity_Activity( (int) $_POST['id'] );
    247249
    248250    // Check access
    249     if ( !bp_activity_user_can_delete() )
    250         return false;
     251    if ( empty( $activity->user_id ) || !bp_activity_user_can_delete( $activity ) ) {
     252        echo '-1';
     253        return false;
     254    }
    251255
    252256    // Call the action before the delete so plugins can still fetch information about it
     
    257261        return false;
    258262    }
    259    
     263
    260264    do_action( 'bp_activity_action_delete_activity', $activity->id, $activity->user_id );
    261265
Note: See TracChangeset for help on using the changeset viewer.