Ticket #26099: 26099.3.patch
File 26099.3.patch, 4.2 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/ms.php
204 204 205 205 clean_user_cache( $user ); 206 206 207 /** 208 * Fires after the user is deleted from the network. 209 * 210 * @since 2.8.0 211 * 212 * @param int $id ID of the user that was deleted from the network. 213 */ 207 /** This action is documented in wp-admin/includes/user.php */ 214 208 do_action( 'deleted_user', $id ); 215 209 216 210 return true; -
src/wp-admin/includes/user.php
109 109 $errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ) ); 110 110 111 111 /* checking the password has been typed twice */ 112 /** 113 * Fires before the password and confirm password fields are checked for congruity. 114 * 115 * @since 1.5.1 116 * 117 * @param string $user_login The username. 118 * @param string &$pass1 The password, passed by reference. 119 * @param string &$pass2 The confirmed password, passed by reference. 120 */ 112 121 do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) ); 113 122 114 123 if ( $update ) { … … 149 158 $errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) ); 150 159 } 151 160 152 // Allow plugins to return their own errors. 161 /** 162 * Fires before user profile update errors are returned. 163 * 164 * @since 2.8.0 165 * 166 * @param array &$errors An array of user profile update errors, passed by reference. 167 * @param bool $update Whether this is a user update. 168 * @param WP_User &$user WP_User object, passed by reference. 169 */ 153 170 do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) ); 154 171 155 172 if ( $errors->get_error_codes() ) … … 184 201 global $wp_roles; 185 202 186 203 $all_roles = $wp_roles->roles; 187 $editable_roles = apply_filters('editable_roles', $all_roles);188 204 205 /** 206 * Filter the list of editable roles. 207 * 208 * @since 2.8.0 209 * 210 * @param array $all_roles List of roles. 211 */ 212 $editable_roles = apply_filters( 'editable_roles', $all_roles ); 213 189 214 return $editable_roles; 190 215 } 191 216 … … 217 242 function get_users_drafts( $user_id ) { 218 243 global $wpdb; 219 244 $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id); 220 $query = apply_filters('get_users_drafts', $query); 245 246 /** 247 * Filter the user's drafts query string. 248 * 249 * @since 2.0.0 250 * 251 * @param string $query The user's drafts query string. 252 */ 253 $query = apply_filters( 'get_users_drafts', $query ); 221 254 return $wpdb->get_results( $query ); 222 255 } 223 256 … … 244 277 if ( !$user->exists() ) 245 278 return false; 246 279 247 // allow for transaction statement 248 do_action('delete_user', $id); 280 /** 281 * Fires immediately before a user is deleted from the database. 282 * 283 * Allows for a transaction statement. 284 * 285 * @since 2.0.0 286 * 287 * @param int $id User ID. 288 */ 289 do_action( 'delete_user', $id ); 249 290 250 291 if ( 'novalue' === $reassign || null === $reassign ) { 251 292 $post_types_to_delete = array(); … … 257 298 } 258 299 } 259 300 301 /** 302 * Filter the list of post types to delete with a user. 303 * 304 * @since 3.4.0 305 * 306 * @param array $post_types_to_delete Post types to delete. 307 * @param int $id User ID. 308 */ 260 309 $post_types_to_delete = apply_filters( 'post_types_to_delete_with_user', $post_types_to_delete, $id ); 261 310 $post_types_to_delete = implode( "', '", $post_types_to_delete ); 262 311 $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $id ) ); … … 301 350 302 351 clean_user_cache( $user ); 303 352 304 // allow for commit transaction 305 do_action('deleted_user', $id); 353 /** 354 * Fires immediately after a user is deleted from the database. 355 * 356 * @since 2.9.0 357 * 358 * @param int $id ID of the deleted user. 359 */ 360 do_action( 'deleted_user', $id ); 306 361 307 362 return true; 308 363 }