Edit File by line
/home/barbar84/www/wp-inclu...
File: user.php
* @type string $user_email The user's email.
[2000] Fix | Delete
* @type string $user_url The user's url.
[2001] Fix | Delete
* @type string $user_nicename The user's nice name. Defaults to a URL-safe version of user's login
[2002] Fix | Delete
* @type string $display_name The user's display name.
[2003] Fix | Delete
* @type string $user_registered MySQL timestamp describing the moment when the user registered. Defaults to
[2004] Fix | Delete
* the current UTC timestamp.
[2005] Fix | Delete
* }
[2006] Fix | Delete
* @param bool $update Whether the user is being updated rather than created.
[2007] Fix | Delete
* @param int|null $id ID of the user to be updated, or NULL if the user is being created.
[2008] Fix | Delete
*/
[2009] Fix | Delete
$data = apply_filters( 'wp_pre_insert_user_data', $data, $update, $update ? (int) $ID : null );
[2010] Fix | Delete
[2011] Fix | Delete
if ( empty( $data ) || ! is_array( $data ) ) {
[2012] Fix | Delete
return new WP_Error( 'empty_data', __( 'Not enough data to create this user.' ) );
[2013] Fix | Delete
}
[2014] Fix | Delete
[2015] Fix | Delete
if ( $update ) {
[2016] Fix | Delete
if ( $user_email !== $old_user_data->user_email || $user_pass !== $old_user_data->user_pass ) {
[2017] Fix | Delete
$data['user_activation_key'] = '';
[2018] Fix | Delete
}
[2019] Fix | Delete
$wpdb->update( $wpdb->users, $data, compact( 'ID' ) );
[2020] Fix | Delete
$user_id = (int) $ID;
[2021] Fix | Delete
} else {
[2022] Fix | Delete
$wpdb->insert( $wpdb->users, $data );
[2023] Fix | Delete
$user_id = (int) $wpdb->insert_id;
[2024] Fix | Delete
}
[2025] Fix | Delete
[2026] Fix | Delete
$user = new WP_User( $user_id );
[2027] Fix | Delete
[2028] Fix | Delete
/**
[2029] Fix | Delete
* Filters a user's meta values and keys immediately after the user is created or updated
[2030] Fix | Delete
* and before any user meta is inserted or updated.
[2031] Fix | Delete
*
[2032] Fix | Delete
* Does not include contact methods. These are added using `wp_get_user_contact_methods( $user )`.
[2033] Fix | Delete
*
[2034] Fix | Delete
* @since 4.4.0
[2035] Fix | Delete
*
[2036] Fix | Delete
* @param array $meta {
[2037] Fix | Delete
* Default meta values and keys for the user.
[2038] Fix | Delete
*
[2039] Fix | Delete
* @type string $nickname The user's nickname. Default is the user's username.
[2040] Fix | Delete
* @type string $first_name The user's first name.
[2041] Fix | Delete
* @type string $last_name The user's last name.
[2042] Fix | Delete
* @type string $description The user's description.
[2043] Fix | Delete
* @type string $rich_editing Whether to enable the rich-editor for the user. Default 'true'.
[2044] Fix | Delete
* @type string $syntax_highlighting Whether to enable the rich code editor for the user. Default 'true'.
[2045] Fix | Delete
* @type string $comment_shortcuts Whether to enable keyboard shortcuts for the user. Default 'false'.
[2046] Fix | Delete
* @type string $admin_color The color scheme for a user's admin screen. Default 'fresh'.
[2047] Fix | Delete
* @type int|bool $use_ssl Whether to force SSL on the user's admin area. 0|false if SSL
[2048] Fix | Delete
* is not forced.
[2049] Fix | Delete
* @type string $show_admin_bar_front Whether to show the admin bar on the front end for the user.
[2050] Fix | Delete
* Default 'true'.
[2051] Fix | Delete
* @type string $locale User's locale. Default empty.
[2052] Fix | Delete
* }
[2053] Fix | Delete
* @param WP_User $user User object.
[2054] Fix | Delete
* @param bool $update Whether the user is being updated rather than created.
[2055] Fix | Delete
*/
[2056] Fix | Delete
$meta = apply_filters( 'insert_user_meta', $meta, $user, $update );
[2057] Fix | Delete
[2058] Fix | Delete
// Update user meta.
[2059] Fix | Delete
foreach ( $meta as $key => $value ) {
[2060] Fix | Delete
update_user_meta( $user_id, $key, $value );
[2061] Fix | Delete
}
[2062] Fix | Delete
[2063] Fix | Delete
foreach ( wp_get_user_contact_methods( $user ) as $key => $value ) {
[2064] Fix | Delete
if ( isset( $userdata[ $key ] ) ) {
[2065] Fix | Delete
update_user_meta( $user_id, $key, $userdata[ $key ] );
[2066] Fix | Delete
}
[2067] Fix | Delete
}
[2068] Fix | Delete
[2069] Fix | Delete
if ( isset( $userdata['role'] ) ) {
[2070] Fix | Delete
$user->set_role( $userdata['role'] );
[2071] Fix | Delete
} elseif ( ! $update ) {
[2072] Fix | Delete
$user->set_role( get_option( 'default_role' ) );
[2073] Fix | Delete
}
[2074] Fix | Delete
[2075] Fix | Delete
clean_user_cache( $user_id );
[2076] Fix | Delete
[2077] Fix | Delete
if ( $update ) {
[2078] Fix | Delete
/**
[2079] Fix | Delete
* Fires immediately after an existing user is updated.
[2080] Fix | Delete
*
[2081] Fix | Delete
* @since 2.0.0
[2082] Fix | Delete
*
[2083] Fix | Delete
* @param int $user_id User ID.
[2084] Fix | Delete
* @param WP_User $old_user_data Object containing user's data prior to update.
[2085] Fix | Delete
*/
[2086] Fix | Delete
do_action( 'profile_update', $user_id, $old_user_data );
[2087] Fix | Delete
[2088] Fix | Delete
if ( isset( $userdata['spam'] ) && $userdata['spam'] != $old_user_data->spam ) {
[2089] Fix | Delete
if ( 1 == $userdata['spam'] ) {
[2090] Fix | Delete
/**
[2091] Fix | Delete
* Fires after the user is marked as a SPAM user.
[2092] Fix | Delete
*
[2093] Fix | Delete
* @since 3.0.0
[2094] Fix | Delete
*
[2095] Fix | Delete
* @param int $user_id ID of the user marked as SPAM.
[2096] Fix | Delete
*/
[2097] Fix | Delete
do_action( 'make_spam_user', $user_id );
[2098] Fix | Delete
} else {
[2099] Fix | Delete
/**
[2100] Fix | Delete
* Fires after the user is marked as a HAM user. Opposite of SPAM.
[2101] Fix | Delete
*
[2102] Fix | Delete
* @since 3.0.0
[2103] Fix | Delete
*
[2104] Fix | Delete
* @param int $user_id ID of the user marked as HAM.
[2105] Fix | Delete
*/
[2106] Fix | Delete
do_action( 'make_ham_user', $user_id );
[2107] Fix | Delete
}
[2108] Fix | Delete
}
[2109] Fix | Delete
} else {
[2110] Fix | Delete
/**
[2111] Fix | Delete
* Fires immediately after a new user is registered.
[2112] Fix | Delete
*
[2113] Fix | Delete
* @since 1.5.0
[2114] Fix | Delete
*
[2115] Fix | Delete
* @param int $user_id User ID.
[2116] Fix | Delete
*/
[2117] Fix | Delete
do_action( 'user_register', $user_id );
[2118] Fix | Delete
}
[2119] Fix | Delete
[2120] Fix | Delete
return $user_id;
[2121] Fix | Delete
}
[2122] Fix | Delete
[2123] Fix | Delete
/**
[2124] Fix | Delete
* Update a user in the database.
[2125] Fix | Delete
*
[2126] Fix | Delete
* It is possible to update a user's password by specifying the 'user_pass'
[2127] Fix | Delete
* value in the $userdata parameter array.
[2128] Fix | Delete
*
[2129] Fix | Delete
* If current user's password is being updated, then the cookies will be
[2130] Fix | Delete
* cleared.
[2131] Fix | Delete
*
[2132] Fix | Delete
* @since 2.0.0
[2133] Fix | Delete
*
[2134] Fix | Delete
* @see wp_insert_user() For what fields can be set in $userdata.
[2135] Fix | Delete
*
[2136] Fix | Delete
* @param array|object|WP_User $userdata An array of user data or a user object of type stdClass or WP_User.
[2137] Fix | Delete
* @return int|WP_Error The updated user's ID or a WP_Error object if the user could not be updated.
[2138] Fix | Delete
*/
[2139] Fix | Delete
function wp_update_user( $userdata ) {
[2140] Fix | Delete
if ( $userdata instanceof stdClass ) {
[2141] Fix | Delete
$userdata = get_object_vars( $userdata );
[2142] Fix | Delete
} elseif ( $userdata instanceof WP_User ) {
[2143] Fix | Delete
$userdata = $userdata->to_array();
[2144] Fix | Delete
}
[2145] Fix | Delete
[2146] Fix | Delete
$ID = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0;
[2147] Fix | Delete
if ( ! $ID ) {
[2148] Fix | Delete
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
[2149] Fix | Delete
}
[2150] Fix | Delete
[2151] Fix | Delete
// First, get all of the original fields.
[2152] Fix | Delete
$user_obj = get_userdata( $ID );
[2153] Fix | Delete
if ( ! $user_obj ) {
[2154] Fix | Delete
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
[2155] Fix | Delete
}
[2156] Fix | Delete
[2157] Fix | Delete
$user = $user_obj->to_array();
[2158] Fix | Delete
[2159] Fix | Delete
// Add additional custom fields.
[2160] Fix | Delete
foreach ( _get_additional_user_keys( $user_obj ) as $key ) {
[2161] Fix | Delete
$user[ $key ] = get_user_meta( $ID, $key, true );
[2162] Fix | Delete
}
[2163] Fix | Delete
[2164] Fix | Delete
// Escape data pulled from DB.
[2165] Fix | Delete
$user = add_magic_quotes( $user );
[2166] Fix | Delete
[2167] Fix | Delete
if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
[2168] Fix | Delete
// If password is changing, hash it now.
[2169] Fix | Delete
$plaintext_pass = $userdata['user_pass'];
[2170] Fix | Delete
$userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );
[2171] Fix | Delete
[2172] Fix | Delete
/**
[2173] Fix | Delete
* Filters whether to send the password change email.
[2174] Fix | Delete
*
[2175] Fix | Delete
* @since 4.3.0
[2176] Fix | Delete
*
[2177] Fix | Delete
* @see wp_insert_user() For `$user` and `$userdata` fields.
[2178] Fix | Delete
*
[2179] Fix | Delete
* @param bool $send Whether to send the email.
[2180] Fix | Delete
* @param array $user The original user array.
[2181] Fix | Delete
* @param array $userdata The updated user array.
[2182] Fix | Delete
*/
[2183] Fix | Delete
$send_password_change_email = apply_filters( 'send_password_change_email', true, $user, $userdata );
[2184] Fix | Delete
}
[2185] Fix | Delete
[2186] Fix | Delete
if ( isset( $userdata['user_email'] ) && $user['user_email'] !== $userdata['user_email'] ) {
[2187] Fix | Delete
/**
[2188] Fix | Delete
* Filters whether to send the email change email.
[2189] Fix | Delete
*
[2190] Fix | Delete
* @since 4.3.0
[2191] Fix | Delete
*
[2192] Fix | Delete
* @see wp_insert_user() For `$user` and `$userdata` fields.
[2193] Fix | Delete
*
[2194] Fix | Delete
* @param bool $send Whether to send the email.
[2195] Fix | Delete
* @param array $user The original user array.
[2196] Fix | Delete
* @param array $userdata The updated user array.
[2197] Fix | Delete
*/
[2198] Fix | Delete
$send_email_change_email = apply_filters( 'send_email_change_email', true, $user, $userdata );
[2199] Fix | Delete
}
[2200] Fix | Delete
[2201] Fix | Delete
clean_user_cache( $user_obj );
[2202] Fix | Delete
[2203] Fix | Delete
// Merge old and new fields with new fields overwriting old ones.
[2204] Fix | Delete
$userdata = array_merge( $user, $userdata );
[2205] Fix | Delete
$user_id = wp_insert_user( $userdata );
[2206] Fix | Delete
[2207] Fix | Delete
if ( ! is_wp_error( $user_id ) ) {
[2208] Fix | Delete
[2209] Fix | Delete
$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
[2210] Fix | Delete
[2211] Fix | Delete
$switched_locale = false;
[2212] Fix | Delete
if ( ! empty( $send_password_change_email ) || ! empty( $send_email_change_email ) ) {
[2213] Fix | Delete
$switched_locale = switch_to_locale( get_user_locale( $user_id ) );
[2214] Fix | Delete
}
[2215] Fix | Delete
[2216] Fix | Delete
if ( ! empty( $send_password_change_email ) ) {
[2217] Fix | Delete
/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
[2218] Fix | Delete
$pass_change_text = __(
[2219] Fix | Delete
'Hi ###USERNAME###,
[2220] Fix | Delete
[2221] Fix | Delete
This notice confirms that your password was changed on ###SITENAME###.
[2222] Fix | Delete
[2223] Fix | Delete
If you did not change your password, please contact the Site Administrator at
[2224] Fix | Delete
###ADMIN_EMAIL###
[2225] Fix | Delete
[2226] Fix | Delete
This email has been sent to ###EMAIL###
[2227] Fix | Delete
[2228] Fix | Delete
Regards,
[2229] Fix | Delete
All at ###SITENAME###
[2230] Fix | Delete
###SITEURL###'
[2231] Fix | Delete
);
[2232] Fix | Delete
[2233] Fix | Delete
$pass_change_email = array(
[2234] Fix | Delete
'to' => $user['user_email'],
[2235] Fix | Delete
/* translators: Password change notification email subject. %s: Site title. */
[2236] Fix | Delete
'subject' => __( '[%s] Password Changed' ),
[2237] Fix | Delete
'message' => $pass_change_text,
[2238] Fix | Delete
'headers' => '',
[2239] Fix | Delete
);
[2240] Fix | Delete
[2241] Fix | Delete
/**
[2242] Fix | Delete
* Filters the contents of the email sent when the user's password is changed.
[2243] Fix | Delete
*
[2244] Fix | Delete
* @since 4.3.0
[2245] Fix | Delete
*
[2246] Fix | Delete
* @param array $pass_change_email {
[2247] Fix | Delete
* Used to build wp_mail().
[2248] Fix | Delete
*
[2249] Fix | Delete
* @type string $to The intended recipients. Add emails in a comma separated string.
[2250] Fix | Delete
* @type string $subject The subject of the email.
[2251] Fix | Delete
* @type string $message The content of the email.
[2252] Fix | Delete
* The following strings have a special meaning and will get replaced dynamically:
[2253] Fix | Delete
* - ###USERNAME### The current user's username.
[2254] Fix | Delete
* - ###ADMIN_EMAIL### The admin email in case this was unexpected.
[2255] Fix | Delete
* - ###EMAIL### The user's email address.
[2256] Fix | Delete
* - ###SITENAME### The name of the site.
[2257] Fix | Delete
* - ###SITEURL### The URL to the site.
[2258] Fix | Delete
* @type string $headers Headers. Add headers in a newline (\r\n) separated string.
[2259] Fix | Delete
* }
[2260] Fix | Delete
* @param array $user The original user array.
[2261] Fix | Delete
* @param array $userdata The updated user array.
[2262] Fix | Delete
*/
[2263] Fix | Delete
$pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata );
[2264] Fix | Delete
[2265] Fix | Delete
$pass_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $pass_change_email['message'] );
[2266] Fix | Delete
$pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $pass_change_email['message'] );
[2267] Fix | Delete
$pass_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $pass_change_email['message'] );
[2268] Fix | Delete
$pass_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $pass_change_email['message'] );
[2269] Fix | Delete
$pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] );
[2270] Fix | Delete
[2271] Fix | Delete
wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] );
[2272] Fix | Delete
}
[2273] Fix | Delete
[2274] Fix | Delete
if ( ! empty( $send_email_change_email ) ) {
[2275] Fix | Delete
/* translators: Do not translate USERNAME, ADMIN_EMAIL, NEW_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
[2276] Fix | Delete
$email_change_text = __(
[2277] Fix | Delete
'Hi ###USERNAME###,
[2278] Fix | Delete
[2279] Fix | Delete
This notice confirms that your email address on ###SITENAME### was changed to ###NEW_EMAIL###.
[2280] Fix | Delete
[2281] Fix | Delete
If you did not change your email, please contact the Site Administrator at
[2282] Fix | Delete
###ADMIN_EMAIL###
[2283] Fix | Delete
[2284] Fix | Delete
This email has been sent to ###EMAIL###
[2285] Fix | Delete
[2286] Fix | Delete
Regards,
[2287] Fix | Delete
All at ###SITENAME###
[2288] Fix | Delete
###SITEURL###'
[2289] Fix | Delete
);
[2290] Fix | Delete
[2291] Fix | Delete
$email_change_email = array(
[2292] Fix | Delete
'to' => $user['user_email'],
[2293] Fix | Delete
/* translators: Email change notification email subject. %s: Site title. */
[2294] Fix | Delete
'subject' => __( '[%s] Email Changed' ),
[2295] Fix | Delete
'message' => $email_change_text,
[2296] Fix | Delete
'headers' => '',
[2297] Fix | Delete
);
[2298] Fix | Delete
[2299] Fix | Delete
/**
[2300] Fix | Delete
* Filters the contents of the email sent when the user's email is changed.
[2301] Fix | Delete
*
[2302] Fix | Delete
* @since 4.3.0
[2303] Fix | Delete
*
[2304] Fix | Delete
* @param array $email_change_email {
[2305] Fix | Delete
* Used to build wp_mail().
[2306] Fix | Delete
*
[2307] Fix | Delete
* @type string $to The intended recipients.
[2308] Fix | Delete
* @type string $subject The subject of the email.
[2309] Fix | Delete
* @type string $message The content of the email.
[2310] Fix | Delete
* The following strings have a special meaning and will get replaced dynamically:
[2311] Fix | Delete
* - ###USERNAME### The current user's username.
[2312] Fix | Delete
* - ###ADMIN_EMAIL### The admin email in case this was unexpected.
[2313] Fix | Delete
* - ###NEW_EMAIL### The new email address.
[2314] Fix | Delete
* - ###EMAIL### The old email address.
[2315] Fix | Delete
* - ###SITENAME### The name of the site.
[2316] Fix | Delete
* - ###SITEURL### The URL to the site.
[2317] Fix | Delete
* @type string $headers Headers.
[2318] Fix | Delete
* }
[2319] Fix | Delete
* @param array $user The original user array.
[2320] Fix | Delete
* @param array $userdata The updated user array.
[2321] Fix | Delete
*/
[2322] Fix | Delete
$email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata );
[2323] Fix | Delete
[2324] Fix | Delete
$email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] );
[2325] Fix | Delete
$email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] );
[2326] Fix | Delete
$email_change_email['message'] = str_replace( '###NEW_EMAIL###', $userdata['user_email'], $email_change_email['message'] );
[2327] Fix | Delete
$email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] );
[2328] Fix | Delete
$email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] );
[2329] Fix | Delete
$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );
[2330] Fix | Delete
[2331] Fix | Delete
wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] );
[2332] Fix | Delete
}
[2333] Fix | Delete
[2334] Fix | Delete
if ( $switched_locale ) {
[2335] Fix | Delete
restore_previous_locale();
[2336] Fix | Delete
}
[2337] Fix | Delete
}
[2338] Fix | Delete
[2339] Fix | Delete
// Update the cookies if the password changed.
[2340] Fix | Delete
$current_user = wp_get_current_user();
[2341] Fix | Delete
if ( $current_user->ID == $ID ) {
[2342] Fix | Delete
if ( isset( $plaintext_pass ) ) {
[2343] Fix | Delete
wp_clear_auth_cookie();
[2344] Fix | Delete
[2345] Fix | Delete
// Here we calculate the expiration length of the current auth cookie and compare it to the default expiration.
[2346] Fix | Delete
// If it's greater than this, then we know the user checked 'Remember Me' when they logged in.
[2347] Fix | Delete
$logged_in_cookie = wp_parse_auth_cookie( '', 'logged_in' );
[2348] Fix | Delete
/** This filter is documented in wp-includes/pluggable.php */
[2349] Fix | Delete
$default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $ID, false );
[2350] Fix | Delete
$remember = false;
[2351] Fix | Delete
if ( false !== $logged_in_cookie && ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ) {
[2352] Fix | Delete
$remember = true;
[2353] Fix | Delete
}
[2354] Fix | Delete
[2355] Fix | Delete
wp_set_auth_cookie( $ID, $remember );
[2356] Fix | Delete
}
[2357] Fix | Delete
}
[2358] Fix | Delete
[2359] Fix | Delete
return $user_id;
[2360] Fix | Delete
}
[2361] Fix | Delete
[2362] Fix | Delete
/**
[2363] Fix | Delete
* A simpler way of inserting a user into the database.
[2364] Fix | Delete
*
[2365] Fix | Delete
* Creates a new user with just the username, password, and email. For more
[2366] Fix | Delete
* complex user creation use wp_insert_user() to specify more information.
[2367] Fix | Delete
*
[2368] Fix | Delete
* @since 2.0.0
[2369] Fix | Delete
*
[2370] Fix | Delete
* @see wp_insert_user() More complete way to create a new user.
[2371] Fix | Delete
*
[2372] Fix | Delete
* @param string $username The user's username.
[2373] Fix | Delete
* @param string $password The user's password.
[2374] Fix | Delete
* @param string $email Optional. The user's email. Default empty.
[2375] Fix | Delete
* @return int|WP_Error The newly created user's ID or a WP_Error object if the user could not
[2376] Fix | Delete
* be created.
[2377] Fix | Delete
*/
[2378] Fix | Delete
function wp_create_user( $username, $password, $email = '' ) {
[2379] Fix | Delete
$user_login = wp_slash( $username );
[2380] Fix | Delete
$user_email = wp_slash( $email );
[2381] Fix | Delete
$user_pass = $password;
[2382] Fix | Delete
[2383] Fix | Delete
$userdata = compact( 'user_login', 'user_email', 'user_pass' );
[2384] Fix | Delete
return wp_insert_user( $userdata );
[2385] Fix | Delete
}
[2386] Fix | Delete
[2387] Fix | Delete
/**
[2388] Fix | Delete
* Returns a list of meta keys to be (maybe) populated in wp_update_user().
[2389] Fix | Delete
*
[2390] Fix | Delete
* The list of keys returned via this function are dependent on the presence
[2391] Fix | Delete
* of those keys in the user meta data to be set.
[2392] Fix | Delete
*
[2393] Fix | Delete
* @since 3.3.0
[2394] Fix | Delete
* @access private
[2395] Fix | Delete
*
[2396] Fix | Delete
* @param WP_User $user WP_User instance.
[2397] Fix | Delete
* @return string[] List of user keys to be populated in wp_update_user().
[2398] Fix | Delete
*/
[2399] Fix | Delete
function _get_additional_user_keys( $user ) {
[2400] Fix | Delete
$keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'syntax_highlighting', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale' );
[2401] Fix | Delete
return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) );
[2402] Fix | Delete
}
[2403] Fix | Delete
[2404] Fix | Delete
/**
[2405] Fix | Delete
* Set up the user contact methods.
[2406] Fix | Delete
*
[2407] Fix | Delete
* Default contact methods were removed in 3.6. A filter dictates contact methods.
[2408] Fix | Delete
*
[2409] Fix | Delete
* @since 3.7.0
[2410] Fix | Delete
*
[2411] Fix | Delete
* @param WP_User $user Optional. WP_User object.
[2412] Fix | Delete
* @return string[] Array of contact method labels keyed by contact method.
[2413] Fix | Delete
*/
[2414] Fix | Delete
function wp_get_user_contact_methods( $user = null ) {
[2415] Fix | Delete
$methods = array();
[2416] Fix | Delete
if ( get_site_option( 'initial_db_version' ) < 23588 ) {
[2417] Fix | Delete
$methods = array(
[2418] Fix | Delete
'aim' => __( 'AIM' ),
[2419] Fix | Delete
'yim' => __( 'Yahoo IM' ),
[2420] Fix | Delete
'jabber' => __( 'Jabber / Google Talk' ),
[2421] Fix | Delete
);
[2422] Fix | Delete
}
[2423] Fix | Delete
[2424] Fix | Delete
/**
[2425] Fix | Delete
* Filters the user contact methods.
[2426] Fix | Delete
*
[2427] Fix | Delete
* @since 2.9.0
[2428] Fix | Delete
*
[2429] Fix | Delete
* @param string[] $methods Array of contact method labels keyed by contact method.
[2430] Fix | Delete
* @param WP_User $user WP_User object.
[2431] Fix | Delete
*/
[2432] Fix | Delete
return apply_filters( 'user_contactmethods', $methods, $user );
[2433] Fix | Delete
}
[2434] Fix | Delete
[2435] Fix | Delete
/**
[2436] Fix | Delete
* The old private function for setting up user contact methods.
[2437] Fix | Delete
*
[2438] Fix | Delete
* Use wp_get_user_contact_methods() instead.
[2439] Fix | Delete
*
[2440] Fix | Delete
* @since 2.9.0
[2441] Fix | Delete
* @access private
[2442] Fix | Delete
*
[2443] Fix | Delete
* @param WP_User $user Optional. WP_User object. Default null.
[2444] Fix | Delete
* @return string[] Array of contact method labels keyed by contact method.
[2445] Fix | Delete
*/
[2446] Fix | Delete
function _wp_get_user_contactmethods( $user = null ) {
[2447] Fix | Delete
return wp_get_user_contact_methods( $user );
[2448] Fix | Delete
}
[2449] Fix | Delete
[2450] Fix | Delete
/**
[2451] Fix | Delete
* Gets the text suggesting how to create strong passwords.
[2452] Fix | Delete
*
[2453] Fix | Delete
* @since 4.1.0
[2454] Fix | Delete
*
[2455] Fix | Delete
* @return string The password hint text.
[2456] Fix | Delete
*/
[2457] Fix | Delete
function wp_get_password_hint() {
[2458] Fix | Delete
$hint = __( 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).' );
[2459] Fix | Delete
[2460] Fix | Delete
/**
[2461] Fix | Delete
* Filters the text describing the site's password complexity policy.
[2462] Fix | Delete
*
[2463] Fix | Delete
* @since 4.1.0
[2464] Fix | Delete
*
[2465] Fix | Delete
* @param string $hint The password hint text.
[2466] Fix | Delete
*/
[2467] Fix | Delete
return apply_filters( 'password_hint', $hint );
[2468] Fix | Delete
}
[2469] Fix | Delete
[2470] Fix | Delete
/**
[2471] Fix | Delete
* Creates, stores, then returns a password reset key for user.
[2472] Fix | Delete
*
[2473] Fix | Delete
* @since 4.4.0
[2474] Fix | Delete
*
[2475] Fix | Delete
* @global PasswordHash $wp_hasher Portable PHP password hashing framework.
[2476] Fix | Delete
*
[2477] Fix | Delete
* @param WP_User $user User to retrieve password reset key for.
[2478] Fix | Delete
* @return string|WP_Error Password reset key on success. WP_Error on error.
[2479] Fix | Delete
*/
[2480] Fix | Delete
function get_password_reset_key( $user ) {
[2481] Fix | Delete
global $wp_hasher;
[2482] Fix | Delete
[2483] Fix | Delete
if ( ! ( $user instanceof WP_User ) ) {
[2484] Fix | Delete
return new WP_Error( 'invalidcombo', __( '<strong>Error</strong>: There is no account with that username or email address.' ) );
[2485] Fix | Delete
}
[2486] Fix | Delete
[2487] Fix | Delete
/**
[2488] Fix | Delete
* Fires before a new password is retrieved.
[2489] Fix | Delete
*
[2490] Fix | Delete
* Use the {@see 'retrieve_password'} hook instead.
[2491] Fix | Delete
*
[2492] Fix | Delete
* @since 1.5.0
[2493] Fix | Delete
* @deprecated 1.5.1 Misspelled. Use {@see 'retrieve_password'} hook instead.
[2494] Fix | Delete
*
[2495] Fix | Delete
* @param string $user_login The user login name.
[2496] Fix | Delete
*/
[2497] Fix | Delete
do_action_deprecated( 'retreive_password', array( $user->user_login ), '1.5.1', 'retrieve_password' );
[2498] Fix | Delete
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function