Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#41757 new enhancement

Add action inside of add_new_user_to_blog() function

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by:
Milestone: Future Release Priority: low
Severity: minor Version: 3.0
Component: Users Keywords: has-patch needs-testing
Focuses: multisite Cc:

Description

When adding a new user to a site in multisite, the full $meta array is passed in from the relative entry in the wp_signups database table, but it's impossible to do anything with it here because no action exists in this function.

  • A similar action does already exist in add_existing_user_to_blog().
  • We could use the wpmu_activate_user hook, but we'd need to reconfirm if the user was added to the site again, which is not ideal because some complex blog switching may need to occur to do so

I'll attach a patch shortly that adds an action to match add_existing_user_to_blog().

Attachments (2)

41757.diff (691 bytes) - added by johnjamesjacoby 7 years ago.
Adds added_new_user action (no prefix, no suffix, because multisite)
ms-functions.diff (1.1 KB) - added by danieltj 7 years ago.
Adds hook to new user function.

Download all attachments as: .zip

Change History (7)

@johnjamesjacoby
7 years ago

Adds added_new_user action (no prefix, no suffix, because multisite)

#1 @birgire
7 years ago

  • Keywords has-patch added

#2 @jeremyfelt
7 years ago

  • Milestone changed from Awaiting Review to Future Release

I think a hook here makes sense.

I *could* see calling it added_new_user_to_blog to match with the add_new_user_to_blog action rather than the added_existing_user action. It at least seems a little less generic then. :)

Also - the function docs need to be updated to indicate that $password is no longer an ignored parameter, but is passed to the action.

@danieltj
7 years ago

Adds hook to new user function.

#3 @danieltj
7 years ago

I've added a patch which includes the new hook with the proposed name by @jeremyfelt.

To note:

  • Updated the docs for $password to reflect it's new use.
  • Added $blog_id as the last function to match the main functions order.
  • Hook is only run when there is no error from ! is_wp_error( $result ).

Thoughts? :)

#4 @danieltj
7 years ago

  • Keywords needs-testing added

Is anyone available to test this out? Any opinions on this at all etc?

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


7 years ago

Note: See TracTickets for help on using tickets.