WordPress.org

Forums

Importing another DB's info into new WordPress users ? (3 posts)

  1. Sabinou
    Member
    Posted 3 years ago #

    Hello,

    My question is complicated, I'm sorry about it :) Please, could I ask for help and advice ? :)

    Take a dedicated server (meaning : total mysql/scripting freedom, a debian + webmin + virtualmin, if the information matters), holding two domains, one with a WordPress blog, and the other domain with another-than-wordpress CMS, with a database, and in its in database, among other elements, "username" and "password" fields.

    I would like to synchronize, on a regular basis (for instance once per day, but cron configuration is not today's topic), the username:password fields of that database with the Users and users_meta fields of the WordPress database .

    So that for every username:password entry of that other-than-wordpress database, a wordpress user is created (if not already existing) with the same login and password.
    The rank of those wordpress users would be the lowest default rank, Subscriber.

    The idea behind this : registration to that blog would not be permitted, being a member would be a privilege coming with members-only advantages (for instance the "no adverts for friends" plugin, to give you an idea). And that privilege would come from being a member in another website. Making the process automated would allow to keep the same credentials, and to save human work time.

    Straight instructions to ask to insert rows if the username doesn't exist yet, with the password, and the default Subscriber options, wouldn't work, since the passwords are not stored in clear in the WordPress DB, and I have no idea how they're mashed/minchd/whatever-you-call-it.
    (Even assuming that the passwords would be stored in clear in the other CMS's database, I'll leave that point aside, it's not wordpress-relevant.)
    And, to be honest, I haven't worked yet on a php script handling two databases at once, I suppose it can be done - I'm just saying this is still alien to me at the moment we speak.

    I hope I'm not asking for the impossible, do you know if it is doable ?
    If there are ways to achieve that result ?

    Thank you VERY MUCH if you can help, I'll be grateful :)

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    I have no idea how they're mashed/minchd/whatever-you-call-it.

    You could try a straight MD5 encryption. Although WP now uses it's own one-way password encryption class, it will accept MD5. Then, on the initial login, it will re-encrypt the password using its own class. At least, that's what I understand from a conversation with Otto a while back - and it does explain how users can still reset the passwords via the database in an emergency. :-)

    Overall, it sounds do-able although - like yourself - I've not tried getting WP to talk to an external db before. It's just the mechanics that would need working out. Maybe run it from WP via a plugin fired by wp-cron?

  3. Sabinou
    Member
    Posted 3 years ago #

    At first I thought of a script running as root, but on second thought, it might be better to run it from wordpress, that's already half of the database "interfacing" job done, haha.

    I'll investigate the MD5 thingy, that will be a start. Thanks Esmi :)

Topic Closed

This topic has been closed to new replies.

About this Topic