Add magic get/set/isset methods to WP_User to avoid data duplication. Standardize on WP_User::ID. Props scribu. see #15458

git-svn-id: http://svn.automattic.com/wordpress/trunk@18504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2011-08-04 03:09:27 +00:00
parent 6e3e6da9bd
commit 6c81d023bb
9 changed files with 54 additions and 37 deletions

View File

@@ -255,7 +255,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'p
if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
return array($user->id);
return array($user->ID);
else
return array();
}

View File

@@ -250,7 +250,7 @@ function send_confirmation_on_profile_email() {
if ( ! is_object($errors) )
$errors = new WP_Error();
if ( $current_user->id != $_POST['user_id'] )
if ( $current_user->ID != $_POST['user_id'] )
return false;
if ( $current_user->user_email != $_POST['email'] ) {

View File

@@ -17,7 +17,7 @@ if ( ! current_user_can('read') )
$action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
$blogs = get_blogs_of_user( $current_user->id );
$blogs = get_blogs_of_user( $current_user->ID );
if ( empty( $blogs ) )
wp_die( __( 'You must be a member of at least one site to use this page.' ) );
@@ -28,7 +28,7 @@ if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
$blog = get_blog_details( (int) $_POST['primary_blog'] );
if ( $blog && isset( $blog->domain ) ) {
update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true );
update_user_option( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true );
$updated = true;
} else {
wp_die( __( 'The primary site you chose does not exist.' ) );

View File

@@ -216,7 +216,7 @@ case 'doremove':
$update = 'remove';
foreach ( $userids as $id ) {
$id = (int) $id;
if ( $id == $current_user->id && !is_super_admin() ) {
if ( $id == $current_user->ID && !is_super_admin() ) {
$update = 'err_admin_remove';
continue;
}
@@ -269,7 +269,7 @@ case 'remove':
foreach ( $userids as $id ) {
$id = (int) $id;
$user = new WP_User($id);
if ( $id == $current_user->id && !is_super_admin() ) {
if ( $id == $current_user->ID && !is_super_admin() ) {
echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
} elseif ( !current_user_can('remove_user', $id) ) {
echo "<li>" . sprintf(__('ID #%1s: %2s <strong>You don\'t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";