Make WordPress Core

Changeset 33708


Ignore:
Timestamp:
08/22/2015 05:11:42 PM (9 years ago)
Author:
wonderboymusic
Message:

In wp_insert_user(), add a filter: insert_user_meta, to filter a user's meta values and keys before the user is created or updated.

Props tharsheblows, chriscct7, DrewAPicture.
Fixes #31549.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r33690 r33708  
    20642064    $user = new WP_User( $user_id );
    20652065
     2066    /**
     2067     * Filter a user's meta values and keys before the user is created or updated.
     2068     *
     2069     * Does not include contact methods. These are added using `wp_get_user_contact_methods( $user )`.
     2070     *
     2071     * @since 4.4.0
     2072     *
     2073     * @param array $meta {
     2074     *     Default meta values and keys for the user.
     2075     *
     2076     *     @type string   $nickname             The user's nickname. Default is the the user's username.
     2077     *     @type string   $first_name           The user's first name.
     2078     *     @type string   $last_name            The user's last name.
     2079     *     @type string   $description          The user's description.
     2080     *     @type bool     $rich_editing         Whether to enable the rich-editor for the user. False if not empty.
     2081     *     @type bool     $comment_shortcuts    Whether to enable keyboard shortcuts for the user. Default false.
     2082     *     @type string   $admin_color          The color scheme for a user's admin screen. Default 'fresh'.
     2083     *     @type int|bool $use_ssl              Whether to force SSL on the user's admin area. 0|false if SSL is
     2084     *                                          not forced.
     2085     *     @type bool     $show_admin_bar_front Whether to show the admin bar on the front end for the user.
     2086     *                                          Default true.
     2087     * }
     2088     * @param WP_User $user User object.
     2089     */
     2090    $meta = apply_filters( 'insert_user_meta', $meta, $user );
     2091
    20662092    // Update user meta.
    20672093    foreach ( $meta as $key => $value ) {
Note: See TracChangeset for help on using the changeset viewer.