herb miller
WordPress plugin specialist
 

Chrome pre-populates New Password field and another when not wanted

For a while now, ever since I started developing oik-user, working with sites with multiple users, I’ve noticed that when editing or viewing the details for a User, the New Password field is pre-populated, and so is the last field before Biographical Info.

But I didn’t REALLY know why; so didn’t know how to stop it. Seems I was not alone with the problem. But is my solution more pragmatic?

The last field gets populated with the currently logged in username. Note: The last field varies depending on the installed plugins. It could be:

  • the Twitter username (without @) field ( courtesy of wordpress-seo v1.4.7 ),
  • Facebook profile URL – with WordPress SEO added v1.4.8
  • with oik-user it’s the Skype [bw_skype] field
  • Without plugins it’s (currently) Jabber / Google Talk

Check these facts

  • The problem only happens with Google Chrome.
  • It’s related to an apparent bug with Google Chrome’s autocomplete.

My solution

The most promising suggestion (before I discovered the WordPress TRAC) came from stackoverflow – use autocomplete="off"

But it seems that WordPress already does this for the New Password field and it doesn’t appear to have worked on most of my sites. Chrome also seemed to ignore me setting autocomplete=”off” on all the other fields.

So the next part of the answer was set a value in the field: blank should do right?

  1. Typing in a non-blank value cures the problem.
  2. Typing in a blank does not. It gets stripped out on next display

BUT, I have discovered that appending a blank to the field before it’s displayed DOES appear to cure the problem. To achieve this I hacked wp-admin/user-edit.php changing value="<?php echo esc_attr($profileuser->$name) ?>" to value="<?php echo esc_attr($profileuser->$name) ?> " Is this worth raising a TRAC for? Yes, there’s already one there. #24364 Fix autocomplete off in Chrome BUT the current workaround seems far too complicated. I’ll suggest mine.

Bonuses!

OH GOOD. I just noticed that in WordPress 3.6 the AIM, Yahoo IM and Jabber / Google Talk are no longer being set as user fields. Never knew what these were for! Glad to see the back of them.

Contact me
Sorry if the input fields are too wide! You can partially blame Jetpack for creating the unwanted CSS and my plugin's use of a table to display the form.

/* table { table-layout: fixed; } */
.textwidget td input[type=text],
.textwidget td input[type=email],
.textwidget td textarea { width: 100%; }
 
Archives