WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How can I change user_login values for LDAP authentication? (2 posts)

  1. dale.vanzile
    Member
    Posted 1 year ago #

    I hope this isn't a duplicate question. I searched, and didn't find a question like it.

    Here's the deal:
    Due to an administrative change of LDAP servers and the naming scheme for users, all of my WP user_login values need to be updated--to the tune of 1500+ users each on about 16 different WP installations that I inherited back in June when their former admin retired.

    How can I do this, preferably programmatically?

    I have access to a database table with the old and new login names, and can script a PHP update routine to replace the old login with the new one. I'm just not sure of where, besides user_login in the wp_users table, I would have to update the user_login data.

    My initial tests with changing the user_login value in the wp_users table (on my own user_login) on a test WP install demonstrate that WP is still holding onto the old user_login value on posts, in spite of the DB only seeming to store the ID number in the post_author field of the wp_posts table. I'm not sure if updating user_login will FUBAR the user's ability to edit their old pages or, worse, lose their content, and I'm definitely not interested in hearing 1500+ people complain about either of those eventualities....

    Any pointers/help would be *greatly* appreciated.

    Thanks!

    --Dale

  2. dale.vanzile
    Member
    Posted 1 year ago #

    Found the missing bit: the display_name and user_nicename fields also need to be updated....

    So:

    UPDATE wp_users u INNER JOIN newDir.hashOldLoginToNew l ON u.user_login = l.oldLogin
    SET
    u.user_login = l.newLogin,
    u.user_nicename = l.newLogin,
    u.display_name = l.newLogin

    works beautifully!

    HTH someone else stuck in this problem....

    --Dale

Topic Closed

This topic has been closed to new replies.

About this Topic