[wp-trac] [WordPress Trac] #38781: Change args in `after_signup_user` action

WordPress Trac noreply at wordpress.org
Mon Nov 14 14:25:37 UTC 2016


#38781: Change args in `after_signup_user` action
--------------------------+-----------------------------
 Reporter:  MaximeCulea   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  multisite     |
--------------------------+-----------------------------
 Hi !

 In 4.4.0 WP's version,
 [[https://core.trac.wordpress.org/changeset/34112|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
 [[https://core.trac.wordpress.org/browser/trunk/src/wp-includes/ms-
 functions.php?rev=34112#L938|wpmu_signup_user_notification]]'s method use
 given `$meta`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38781>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list