[wp-trac] [WordPress Trac] #39829: Missing Filter before user is created within "wp_insert_user" function
WordPress Trac
noreply at wordpress.org
Fri Feb 10 04:21:44 UTC 2017
#39829: Missing Filter before user is created within "wp_insert_user" function
-------------------------+-----------------------------
Reporter: jaschaio | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 4.7.2
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
The "wp_insert_post" function has a filter called "wp_insert_post_data"
that filters the post data right before the post is created.
For me the "wp_insert_user" function should have as well a filter right
before the user is created in the database.
Unfortunately it doesn't exists. There is a action called "user_register"
that lets me do something once the user is created, but it doesn't let me
modify the actual data the "wp_insert_user" function returns.
Background:
I use the "wp_insert_post_data" filter to assign a random unique ID to
each new post. This is helpful if you have a custom post type with
sensitive data, where you don't want to make public how many exists or get
created per day. (If the post ID is only auto increated each day, you
could get this information by quering once in the morning and once in the
night).
But it's impossible to assign a random unique ID to a newly created user.
Or actually, it is not possible, I can hook into the "user_register"
action and udpate all database tables with a new user id. But I can not
use that new information as the "wp_insert_user" function will still
return the old ID.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39829>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list