Changeset 2542
- Timestamp:
- 02/02/2010 06:29:33 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r2539 r2542 333 333 334 334 $activity_id = $bp->action_variables[0]; 335 $activity = new BP_Activity_Activity( $activity_id ); 335 336 336 337 /* Check access */ 337 if ( !is_site_admin() ) { 338 $activity = new BP_Activity_Activity( $activity_id ); 339 340 if ( $activity->user_id != $bp->loggedin_user->id ) 341 return false; 342 } 338 if ( !is_site_admin() && $activity->user_id != $bp->loggedin_user->id ) 339 return false; 343 340 344 341 /* Now delete the activity item */ 345 if ( bp_activity_delete _by_activity_id( $activity_id) )342 if ( bp_activity_delete( array( 'id' => $activity_id, 'user_id' => $activity->user_id ) ) ) 346 343 bp_core_add_message( __( 'Activity deleted', 'buddypress' ) ); 347 344 else … … 350 347 do_action( 'bp_activity_action_delete_activity', $activity_id ); 351 348 352 bp_core_redirect( $_SERVER['HTTP_REFERER']);349 bp_core_redirect( wp_get_referer() ); 353 350 } 354 351 add_action( 'wp', 'bp_activity_action_delete_activity', 3 ); … … 697 694 return false; 698 695 696 /* Check if the user's latest update has been deleted */ 697 if ( empty( $args['user_id'] ) ) 698 $user_id = $bp->loggedin_user->id; 699 else 700 $user_id = $args['user_id']; 701 702 $latest_update = get_usermeta( $user_id, 'bp_latest_update' ); 703 if ( !empty( $latest_update ) ) { 704 if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) ) 705 delete_usermeta( $user_id, 'bp_latest_update' ); 706 } 707 699 708 do_action( 'bp_activity_delete', $args ); 700 709 do_action( 'bp_activity_deleted_activities', $activity_ids_deleted ); -
trunk/bp-themes/bp-default/_inc/ajax.php
r2514 r2542 156 156 } 157 157 158 if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) || !bp_activity_delete( array( 'id' => $_POST['id'] ) ) ) { 158 $activity = new BP_Activity_Activity( $_POST['id'] ); 159 160 /* Check access */ 161 if ( !is_site_admin() && $activity->user_id != $bp->loggedin_user->id ) 162 return false; 163 164 if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) || !bp_activity_delete( array( 'id' => $_POST['id'], 'user_id' => $activity->user_id ) ) ) { 159 165 echo '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>'; 160 166 return false;
Note: See TracChangeset
for help on using the changeset viewer.