[wp-trac] [WordPress Trac] #44293: Discrepancy between documentation and implementation of wp_new_user_notification()

WordPress Trac noreply at wordpress.org
Fri Jun 1 21:32:59 UTC 2018


#44293: Discrepancy between documentation and implementation of
wp_new_user_notification()
--------------------------+-----------------------------
 Reporter:  360zen        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Mail          |    Version:  4.9.6
 Severity:  minor         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Based on the documentation, the options for recipients are 'admin',
 'user', and 'both'. However, the way to send an email to both admin and
 user is actually to enter any arbitrary value for at least one of the two
 unnecessary parameters.

 `wp_new_user_notification($user_id)` or
 `wp_new_user_notification($user_id, null, 'admin')`sends only the admin
 email.

 `wp_new_user_notification($user_id, null, 'user')` sends only the user
 email.

 `wp_new_user_notification($user_id, null, 'anythingYouWant')` sends both.

 One of two things is happening here:

 1. The function is more permissive than intended, allowing any value in
 the $notify parameter. Perhaps the function should actually check for
 'both' instead of simply `return`ing if the two parameters are empty. OR

 2. The documentation is making an unnecessary reference to the word 'both'
 where in reality, any string except 'admin' and 'user' will result in both
 emails being sent. Perhaps the documentation should be changed to suggest
 that acceptable values are 'admin', 'user' or literally any other string
 that returns false on the empty() test on line 1873 of wp-
 includes/pluggable.php.

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


More information about the wp-trac mailing list