diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 99dd164ee..758c065a6 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -118,6 +118,8 @@ function edit_user( $user_id = 0 ) { if ( $update ) { $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true'; $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; + $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; + $user->show_admin_bar_admin = isset( $_POST['admin_bar_admin'] ) ? 'true' : 'false'; } $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 0e296d5ab..41b828136 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -211,10 +211,19 @@ if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?> More information'); ?> - + + + +
+
+ + + + diff --git a/wp-includes/functions.php b/wp-includes/functions.php index f3572bb99..abcb63d63 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -4471,24 +4471,4 @@ function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = ar return false; } -/** - * Set the display status of the admin bar - * - * This can be called immediately upon plugin load. It does not need to be called from a function hooked to the init action. - * - * @since 3.1.0 - * - * @param bool $show Whether to allow the admin bar to show. - * @return void - */ -function show_admin_bar( $show ) { - global $show_admin_bar; - $show_admin_bar = (bool) $show; - - // Remove the object if we are not going to be showing - // Otherwise you have to call this function prior to the init hook for it to work! - if ( ! $show_admin_bar && isset( $GLOBALS['wp_admin_bar'] ) ) - $GLOBALS['wp_admin_bar'] = null; -} - -?> \ No newline at end of file +?> diff --git a/wp-includes/user.php b/wp-includes/user.php index d08c95713..e1ec9630e 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -507,8 +507,7 @@ class WP_User_Query { if ( !empty( $qv['include'] ) ) { $ids = implode( ',', wp_parse_id_list( $qv['include'] ) ); $this->query_where .= " AND $wpdb->users.ID IN ($ids)"; - } - elseif ( !empty($qv['exclude']) ) { + } elseif ( !empty($qv['exclude']) ) { $ids = implode( ',', wp_parse_id_list( $qv['exclude'] ) ); $this->query_where .= " AND $wpdb->users.ID NOT IN ($ids)"; } @@ -1446,6 +1445,12 @@ function wp_insert_user($userdata) { if ( empty($user_registered) ) $user_registered = gmdate('Y-m-d H:i:s'); + + if ( empty($show_admin_bar_front) ) + $show_admin_bar_front = 'true'; + + if ( empty($show_admin_bar_admin) ) + $show_admin_bar_admin = is_multisite() ? 'true' : 'false'; $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login)); @@ -1470,14 +1475,16 @@ function wp_insert_user($userdata) { $user_id = (int) $wpdb->insert_id; } - update_user_meta( $user_id, 'first_name', $first_name); - update_user_meta( $user_id, 'last_name', $last_name); + update_user_meta( $user_id, 'first_name', $first_name ); + update_user_meta( $user_id, 'last_name', $last_name ); update_user_meta( $user_id, 'nickname', $nickname ); update_user_meta( $user_id, 'description', $description ); - update_user_meta( $user_id, 'rich_editing', $rich_editing); - update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts); - update_user_meta( $user_id, 'admin_color', $admin_color); - update_user_meta( $user_id, 'use_ssl', $use_ssl); + update_user_meta( $user_id, 'rich_editing', $rich_editing ); + update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts ); + update_user_meta( $user_id, 'admin_color', $admin_color ); + update_user_meta( $user_id, 'use_ssl', $use_ssl ); + update_user_meta( $user_id, 'show_admin_bar_front', $show_admin_bar_front ); + update_user_meta( $user_id, 'show_admin_bar_admin', $show_admin_bar_admin ); $user = new WP_User($user_id);