Ticket #26099: 26099.2.patch
File 26099.2.patch, 3.3 KB (added by , 11 years ago) |
---|
-
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 2.0.0 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 $editable_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 … … 245 278 return false; 246 279 247 280 // allow for transaction statement 281 /** This action is documented in wp-admin/includes/user.php */ 248 282 do_action('delete_user', $id); 249 283 250 284 if ( 'novalue' === $reassign || null === $reassign ) { … … 257 291 } 258 292 } 259 293 294 /** 295 * Filter the list of post types to delete with a user. 296 * 297 * @since 3.4.0 298 * 299 * @param array $post_types_to_delete Post types to delete. 300 * @param int $id User ID. 301 */ 260 302 $post_types_to_delete = apply_filters( 'post_types_to_delete_with_user', $post_types_to_delete, $id ); 261 303 $post_types_to_delete = implode( "', '", $post_types_to_delete ); 262 304 $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 ) ); … … 302 344 clean_user_cache( $user ); 303 345 304 346 // allow for commit transaction 347 /** This action is documented in wp-admin/includes/user.php */ 305 348 do_action('deleted_user', $id); 306 349 307 350 return true;