SFC plugin addition: Disable Password Nagging

Posted by on

If you use the Simple Facebook Connect plugin for WordPress (and I really do recommend using it), you might have noticed that you will get an error message each time you login to the admin panel.

Notice: you're using the auto-generated password for your account. Would you like to change it to something you'll remember easier?

This is not just something admins see: every user can access certain parts of the WP admin panel, for instance when they want to change their settings. Usually this warning would be pretty useful too, but if you use Facebook Connect to login you will never ever use or have to change your password. This means the warning is totally useless, and should just be hidden.

I wrote a small plugin that does just that: hide the generated password error for users that login using Facebook (or as WordPress itself calls it, “default password nagging”).

Code

The code for the plugin is in fact so small I’ll just post it here. In fact, half of the code is comments that WordPress uses to load the plugin in the admin panel and add some info. Here it is:

<?php
/*
Plugin Name: SFC - Disable Password Nagging
Plugin URI: http://stephanmuller.nl/sfc-wordpress-disable-password-nagging/
Description: Hides the "generated password" error in the admin panel for users that log in using SFC
Author: Stephan Muller
Version: 1.0
Author URI: http://stephanmuller.nl
License: GPL
*/

add_action('admin_head','stop_nagging');
function stop_nagging() {
  $fbuid = get_user_meta(wp_get_current_user()->ID, 'fbuid', true);

  if($fbuid) {
    remove_action('admin_notices', 'default_password_nag');
  }
}
?>

Installation

Just download sfc-disable-password-nagging.zip and upload it to the /wp-content/plugins/ folder of your WordPress blog. Or if you prefer you can upload it into the simple-facebook-connect folder in the plugins folder to keep it together with it’s SFC friends.

Then just go to your plugins settings panel (/wp-admin/plugins.php) and activate the plugin called SFC – Disable Password Nagging.

Enjoy!

2 Responses to “SFC plugin addition: Disable Password Nagging”

  1. Otto said on

    Good one. I’ll add that to the SFC-Register plugin, since the only real time you’re going to have that problem is when somebody uses FB to create their account.

  2. Stephan said on

    Whoa, now that’s a quick answer! Let me know if you added it, so I can update my post. I love SFC by the way, it’s nice to be able to contribute (even if it’s just a small part) :P

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>