wphooks.info - wp_pre_insert_user_data

wp_pre_insert_user_data

*** New in v4.9 ***

The hook occurs in the following file:

wp-includes/user.php:
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
	 *     @type string $user_email      The user's email.
	 *     @type string $user_url        The user's url.
	 *     @type string $user_nicename   The user's nice name. Defaults to a URL-safe version of user's login
	 *     @type string $display_name    The user's display name.
	 *     @type string $user_registered MySQL timestamp describing the moment when the user registered. Defaults to
	 *                                   the current UTC timestamp.
	 * }
	 * @param bool     $update Whether the user is being updated rather than created.
	 * @param int|null $id     ID of the user to be updated, or NULL if the user is being created.
	 */
	$data = apply_filters( 'wp_pre_insert_user_data', $data, $update, $update ? (int) $ID : null );

	if ( $update ) {
		if ( $user_email !== $old_user_data->user_email ) {
			$data['user_activation_key'] = '';
		}
		$wpdb->update( $wpdb->users, $data, compact( 'ID' ) );
		$user_id = (int) $ID;
	} else {
		$wpdb->insert( $wpdb->users, $data );