Make WordPress Core

Opened 9 years ago

Last modified 6 years ago

#35427 new enhancement

add filter on the wpmu_signup_user() meta values in user-new

Reported by: pbearne's profile pbearne Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Login and Registration Keywords: has-patch
Focuses: multisite Cc:

Description

I want to add additional meta when signing up a new user so I need a filter to allow this

note. the s2member multi-site setup requires c a core mode to allow this

Attachments (3)

user-new.php.patch (1.1 KB) - added by pbearne 9 years ago.
patch
35427.patch (4.1 KB) - added by pbearne 9 years ago.
patch with both filters
35427.2.patch (1.8 KB) - added by jjeaton 8 years ago.

Download all attachments as: .zip

Change History (10)

@pbearne
9 years ago

patch

#1 @pbearne
9 years ago

  • Keywords has-patch needs-codex dev-feedback added

#2 @ericlewis
9 years ago

  • Focuses multisite added
  • Keywords needs-codex removed
  • Version changed from trunk to 3.0

Removing needs-codex for now. A new hook would be automatically added to the Hooks reference. If there's other Codex changes that should be made, let's wait until this is out of the Awaiting Review milestone.

#3 follow-up: @swissspidy
9 years ago

Why not add a filter inside wpmu_signup_user() instead of wp-admin/user-new.php? Users can be added from many different places.

For comparison, wp_insert_user has lots of filters as well, including insert_user_meta to filter a user's meta values and keys before the user is created or updated.

@pbearne
9 years ago

patch with both filters

#5 in reply to: ↑ 3 @jeremyfelt
9 years ago

  • Keywords needs-refresh added; has-patch dev-feedback removed
  • Milestone changed from Awaiting Review to Future Release

The add_signup_meta filter is already used with wpmu_signup_user() in wp-signup.php. I don't see any issues adding this in user-new.php as well.

Replying to swissspidy:

Why not add a filter inside wpmu_signup_user() instead of wp-admin/user-new.php? Users can be added from many different places.

This could make sense. I don't think it would affect any current uses of the filter. Unless someone is using wpmu_signup_user() manually and not expecting $meta to be filtered already. Probably worth some exploration.

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


9 years ago

@jjeaton
8 years ago

#7 @jjeaton
8 years ago

  • Keywords has-patch added; needs-refresh removed

Refreshed the patch, updated filter docblock to reference 4.7. Removed extra changes that were unrelated to the goal of this ticket. Patch now applies cleanly from root of develop checkout.

While it would have been great to have the filter within wpmu_signup_user() all along, I do think that adding it in wp-admin/user-new.php is necessary for consistency with other usages of wpmu_signup_user().

I came across this bug when we noticed differences between users registering on the front-end and when they were created by an admin from user-new.php. Would love to get this into 4.7.

Note: See TracTickets for help on using tickets.