#38781 closed defect (bug) (fixed)
Change args in `after_signup_user` action
Reported by: | MaximeCulea | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.8 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Users | Keywords: | has-patch 2nd-opinion |
Focuses: | multisite | Cc: |
Description
Hi !
In 4.4.0 WP's version, 34112's ticket has been merged, including after_signup_user
's action. The phpdoc is saying that $meta
is an array :
* @param array $meta Additional signup meta. By default, this is an empty array.
It's not really true, because just before, l.723, we can find this : $meta = serialize($meta);
So or we update the phpdoc, saying it's a string (serialized array), or we change this 4th args' format.
This last option it's my favorite one, that's why I am proposing to change after_signup_user
's action's 4th args from $meta
into unserialize( $meta )
, according to the phpdoc, which I agree with. It's much easier to use data which is already unserialized !
In fact for efficiency purpose, I prefer not to overwrite $meta value with serialized one, as l.723, but directly doing it inside wpdb->insert()
args. This way, the $meta variable is not serialized and can be passed as it to after_signup_user's action's args.
By changing this behaviour, we could also fix how wpmu_signup_user_notification's method use given $meta
.
Attachments (1)
Change History (10)
This ticket was mentioned in Slack in #core by helen. View the logs.
8 years ago
#6
@
8 years ago
+1 on this change, as an argument, wpmu_activate_signup
function have a similar action :
<?php do_action( 'wpmu_activate_user', $user_id, $password, $meta );
But just before this action, there is a $meta = maybe_unserialize($signup->meta);
, so in my opinion we have to keep consistency with use of $meta
array and don't pass a serialized string.
By the way, this other ticket #39223 will benefit from this one by using a non serialized array for $meta var.
Thanks for opening a ticket and submitting a patch, @MaximeCulea. I'm going to milestone this as a future release as we should either fix the docs or the default here.