Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#53110 closed enhancement (fixed)

Pass `$userdata` to the actions and filters in `wp_insert_user()`

Reported by: johnbillion's profile johnbillion Owned by: desrosj's profile desrosj
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch needs-dev-note
Focuses: Cc:

Description

There are several actions and filters inside wp_insert_user() which would benefit from being able to access the raw $userdata array that's passed into the function.

One use case is extending the wp user import-csv command in WP-CLI. This command is a wrapper for wp_insert_user() but it's not possible to provide custom user meta fields because there's nowhere inside wp_insert_user() where a plugin can access the raw data array in order to add the user meta.

Change History (6)

This ticket was mentioned in PR #1212 on WordPress/wordpress-develop by johnbillion.


4 years ago
#1

  • Keywords has-patch added; needs-patch removed

#2 @audrasjb
4 years ago

+1 for this proposal. Just figured it out while I was working on #53109.

The PR looks good to me :)

#3 @desrosj
4 years ago

  • Owner set to desrosj
  • Status changed from new to reviewing

#4 @desrosj
4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 51005:

Users: Pass on the user data received by wp_insert_user() to related hooks.

This adds a new parameter to the action and filter hooks found in wp_insert_user() to pass the raw user data received through $userdata to hooked functions.

This will allow hooked functions to perform more contextual adjustments to new users, and makes supplying custom user meta fields possible.

Props johnbillion, audrasjb.
Fixes #53110.

#5 @milana_cap
4 years ago

  • Keywords needs-dev-note added
Note: See TracTickets for help on using tickets.