[wp-trac] [WordPress Trac] #27006: New user "Send this password to the new user by email" toggle option value not remembered

WordPress Trac noreply at wordpress.org
Thu Feb 6 22:35:48 UTC 2014


#27006: New user "Send this password to the new user by email" toggle option value
not remembered
--------------------------------------+------------------------------
 Reporter:  setsailmedia              |       Owner:  chriseverson
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Users                     |     Version:  3.8.1
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:  administration
--------------------------------------+------------------------------

Comment (by chriseverson):

 Replying to [comment:4 nacin]:
 > Replying to [comment:3 chriseverson]:
 > > Just submitted a patch. Next step will be to look into the root of the
 issue in the {{{checked()}}}  function.
 >
 > Thanks for the patch, chriseverson!
 >
 > The issue is that checked() is explicit — it wants true === true, not
 just 'on' == true. (Or more accurately, it converts both to a string and
 then does a comparison. 'on' does not equal '1'.) checked() isn't the
 problem here.
 >
 > Rather, our ugly code that sets this $new_user_send_password variable
 simply sets it to the value of `$_POST['send_password']` if it's set, or
 false if it's not. Checkboxes without values in the HTML end up receiving
 'on' as a value.
 >
 > This fix is a bit cryptic; simply casting the variable to a boolean
 would probably solve it in a slightly better way. So, `checked( (bool)
 $new_user_send_password )`. Make sense?

 Yeah, that's a much cleaner method. There I was overthinking...

 Patch updated.

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


More information about the wp-trac mailing list