WordPress.org

Ready to get started?Download WordPress

Forums

Buddypress Force Password Change
All User Force (7 posts)

  1. nobodymove
    Member
    Posted 1 year ago #

    Hi, it'd be great if there was a way to mass force all users to change their password upon first login. Any chance you'll be adding that function?

    http://wordpress.org/extend/plugins/buddy-press-force-password-change/

  2. landwire
    Member
    Posted 4 months ago #

    I was wondering as well if there would be an option to force users to change their password on first login. Is that possible? With a hook or filter?
    Thanks,
    Sascha

  3. landwire
    Member
    Posted 4 months ago #

    Ok, solved this by adding this on creation of the user to their user meta:

    // force password change on first login
    update_usermeta( $user_id, 'force_password_change', 'yes' );

    When the first login, then they have to enter a new password.
    Maybe it helps somebody :)
    Sascha

  4. jsafire
    Member
    Posted 4 months ago #

    Sascha -

    To which file did you add this code?

    Thx,
    Jeff

  5. landwire
    Member
    Posted 4 months ago #

    Hi Jeff,

    I create users by using a plugin, so that function is hooked into that.
    Otherwise this wordpress hook might come in useful, but I have not tested it:

    http://codex.wordpress.org/Plugin_API/Action_Reference/user_register

    add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
    
    function myplugin_registration_save( $user_id ) {
    
        // force password change on first login
        update_usermeta( $user_id, 'force_password_change', 'yes' );
    
    }

    That code would go into your functions.php or a custom plugin.
    Obviously you could adjust the code above to only force users of a certain role to change their password etc. All you need to do is just check for the users capabilities and then update their meta or not.
    S

  6. jsafire
    Member
    Posted 4 months ago #

    Sascha -

    Thanks for all this. Simple but helpful.
    Are you using your own plugin for creating users or from the WP repos'y or premium?
    I am looking for a way to create new users but, haven't found the right one yet. I also need a way for users to change their own password and haven't found that yet either.

    Have a good one.
    jeff

  7. landwire
    Member
    Posted 4 months ago #

    Hi Jeff,

    all depends what you want to do. I use BuddyPress which I think let users change their passwords under "Settings" on the front end. Also depends if your users have access to backend or not. Then they can just change it there.

    Creating users: well, users can just register on my site, but they need a registration code to do that. If you want to create users manually then you can use the backend.
    As said, all depends what and how you want to do things.
    S

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.