[wp-hackers] Re: [wp-svn] [2698] trunk/wp-admin: wp_delete_user()

Peter Westwood peter.westwood at ftwr.co.uk
Tue Jul 5 09:40:23 GMT 2005


Looking at this changeset: http://trac.wordpress.org/changeset/2698

        310        $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
        311  	    if ($post_ids) {
  	312 	        $post_ids = implode(',', $post_ids);
  	313
  	314 	        // Delete comments, *backs
  	315 	        $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID IN ($post_ids)");
  	316 	        // Clean cats
  	317 	        $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id IN ($post_ids)");
  	318 	        // Clean post_meta
  	319 	        $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id IN ($post_ids)");
  	320 	        // Clean links
  	321 	        $wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
  	322 	        // Delete posts
  	323 	        $wpdb->query("DELETE FROM $wpdb->posts WHERE post_author = $id");
  	324 	    }

Shouldn't the delete's for links be outside the check for posts otherwise we can end up with orphaned links with no
owner because the owner only had links and no posts.

westi
-- 
Peter Westwood
Blog: http://www.ftwr.co.uk/blog/
Get Firefox: http://www.spreadfirefox.com/?q=affiliates&id=20287
-------------- next part --------------
An embedded message was scrubbed...
From: m at wordpress.org
Subject: [wp-svn] [2698] trunk/wp-admin: wp_delete_user()
Date: Mon,  4 Jul 2005 22:03:43 +0000 (GMT)
Size: 7302
Url: http://comox.textdrive.com/pipermail/wp-hackers/attachments/20050705/a3a472e5/wp_delete_user-0001.mht


More information about the wp-hackers mailing list