[wp-trac] Re: [WordPress Trac] #7774: Deleting a user does not update link category count

WordPress Trac wp-trac at lists.automattic.com
Sun Sep 21 06:38:36 GMT 2008


#7774: Deleting a user does not update link category count
----------------------------+-----------------------------------------------
 Reporter:  TimButterfield  |        Owner:  anonymous
     Type:  defect          |       Status:  new      
 Priority:  normal          |    Milestone:  2.8      
Component:  General         |      Version:  2.6.1    
 Severity:  normal          |   Resolution:           
 Keywords:                  |  
----------------------------+-----------------------------------------------
Comment (by TimButterfield):

 The fix for this is to modify wp-admin\includes\user.php.  In the
 wp_delete_user function, replace this code:
 {{{
                 // Clean links
                 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links
 WHERE link_owner = %d", $id) );
 }}}

 with this code:

 {{{
                 // Clean links
                 $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT LINK_ID
 FROM $wpdb->links WHERE link_owner = %d", $id) );

                 if ($link_ids) {
                         foreach ($link_ids as $link_id)
                                 wp_delete_link($link_id);
                 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7774#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list