[wp-trac] [WordPress Trac] #33587: Notification Functions Should be Replaced by Hooks

WordPress Trac noreply at wordpress.org
Sun Sep 13 13:01:57 UTC 2015


#33587: Notification Functions Should be Replaced by Hooks
-------------------------+------------------
 Reporter:  dshanske     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  4.4
Component:  Mail         |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------

Comment (by boonebgorges):

 This is getting close - thanks all.

 Two comments:

 - I know I originally suggested it, but passing the string `'both'` to a
 filter is really ugly. Let's have a new wrapper function, something like
 `wp_send_new_user_notification( $user_id )`, which will call
 `wp_new_user_notification( $user_id, 'both' )`.
 - I haven't looked closely, but are we certain that we want to have the
 same hook name for all of these user creation locations? 'create_user'
 seems too general for me - at the very least, I'd like to see the action
 name describe more specifically what's happening at each of the points
 where it's called. (The fact that the exact same action is being suggested
 in wp-admin/network/user-new.php and in wp-admin/includes/user.php is a
 code smell to me.) Let's only duplicate action names if it really is the
 exact same thing that's happening in each spot. And if we do duplicate
 names, let's use the correct documentation formatting:
 https://make.wordpress.org/core/handbook/best-practices/inline-
 documentation-standards/php/#4-1-duplicate-hooks
 - Related to the above, I think it should be researched whether
 'user_register' could be used. If we need to introduce a new wrapper to
 handle a bit of the logic that's currently inline in the various places
 where the notification function is called, it's probably preferable to do
 that than to introduce new actions (because actions, once introduced, must
 be maintained forever). As a rule, actions are like signposts, and they
 should be put into places that are neither too specific nor too general. A
 good test is probably: if we're having a hard time coming up with a
 succinct name for the action, then maybe the action we're proposing is not
 a good one.
 - What jeremyfelt said about `'after_signup_site'` :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33587#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list