Override default password nag
-
For some reason my default password nag is playing up on a big multi-user site I’ve setup. Pretty sure it’s got to do with the New User Approve and Gravity Forms User Rego combo that I’m using.
Anyway, problem is I need to hack the core WP code every time I upgrade. The wp-admin/includes/user.php file has the ‘default password nag’ function… so I just change this to the wording I want. But of course it doesn’t stick and needs to be done every upgrade! Big hassle.
Does anyone have any better ideas? The simple thing I’m looking for is the wording in functions.php or a custom plugin that will override the default password nag function. That is:
add_action('admin_notices', 'default_password_nag'); /** * @since 2.8.0 */ function default_password_nag() { global $pagenow; if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') ) //Short circuit it. return; echo '<div class="error default-password-nag">'; echo '<p>'; echo '<strong>' . __('Notice:') . '</strong> '; _e('You’re using the auto-generated password for your account. Would you like to change it to something easier to remember?'); echo '</p><p>'; printf( '<a href="%s">' . __('Yes, take me to my profile page') . '</a> | ', get_edit_profile_url( get_current_user_id() ) . '#password' ); printf( '<a href="%s" id="default-password-nag-no">' . __('No thanks, do not remind me again') . '</a>', '?default_password_nag=0' ); echo '</p></div>'; }each time I change it to this, which works a treat:
add_action('admin_notices', 'default_password_nag'); /** * @since 2.8.0 */ function default_password_nag() { global $pagenow; if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') ) //Short circuit it. return; echo '<div class="error default-password-nag">'; echo '<p>Visit your '; printf( '<a href="%s">' . __('profile page') . '</a> to update your password any time. ', admin_url('profile.php') . '#password' ); echo '</p></div>'; }But I want a permanent fix. Thanks 🙂
The topic ‘Override default password nag’ is closed to new replies.