The MU forums have moved to WordPress.org

I want to import users (15 posts)

  1. kernelpanic
    Member
    Posted 17 years ago #

    Due english is my second languaje... i apologize in front for any misspell or gramar failure.

    I'm running a mambo based website and i'll like to give hosted blog to my users
    how can i do to make wordpressmu use the mambo user database?

  2. drmike
    Member
    Posted 17 years ago #

    What are the fields and field types for the mambo user database?

  3. kernelpanic
    Member
    Posted 17 years ago #

    Field; Type; Collation; Attributes; Null; Default;
    id; int(11); No; auto_increment;
    name; varchar(50); latin1_swedish_ci; No;
    username; varchar(25); latin1_swedish_ci; No;
    email; varchar(100); latin1_swedish_ci; No;
    password; varchar(100); latin1_swedish_ci; No;
    usertype; varchar(25); latin1_swedish_ci; No;
    block; tinyint(4); No; 0;
    sendEmail; tinyint(4); Yes;
    gid; tinyint(3); UNSIGNED; No; 0;
    registerDate; datetime; No; 1;
    lastvisitDate; datetime; No; 0000-00-00 00:00:00;
    activation; varchar(100); latin1_swedish_ci; No; 0000-00-00 00:00:00;
    params; text; latin1_swedish_ci; No;

  4. drmike
    Member
    Posted 17 years ago #

    Working this out in my head. Here's the user table for WPMU by the way:

    CREATE TABLE wp_users (
    ID bigint(20) unsigned NOT NULL auto_increment,
    user_login varchar(60) NOT NULL default '',
    user_pass varchar(64) NOT NULL default '',
    user_nicename varchar(50) NOT NULL default '',
    user_email varchar(100) NOT NULL default '',
    user_url varchar(100) NOT NULL default '',
    user_registered datetime NOT NULL default '0000-00-00 00:00:00',
    user_activation_key varchar(60) NOT NULL default '',
    user_status int(11) NOT NULL default '0',
    display_name varchar(250) NOT NULL default '',
    spam tinyint(2) NOT NULL default '0',
    deleted tinyint(2) NOT NULL default '0',
    PRIMARY KEY (ID),
    KEY user_login_key (user_login)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    I need to compare the lists so expect another post in a few minutes.

  5. drmike
    Member
    Posted 17 years ago #

    With a clean install of WPMU and I'm hoping you have phpMyAdmin installed...

    - delete the wp_users table out of the WPMU database.

    - export the user table out of Mambo and import it into WPMU's database. Rename it to wp_users.

    - modify the ID table from int(11) to bigint(20)

    - rename 'password' (I'm assuming that it's MD5) to 'user_pass' and modify to varchar(64)

    - rename 'email' to 'user_email'. Both are varchar(100) so you don't have to modify it.

    - Delete usertype, block, sendEmail, params, gid, lastvisitDate, and activation.

    - rename 'registerDate' to user_registered. Both are date time so you shouldn't have to modify it.

    - create the following tables as above in my list: user_url, user_nicename, user_activation_key, user_status, display_name, spam, and deleted. The user can go back in and choose their URL. The others are defaulted to blank or zeros for active users so they should be a problem. user_nicename we're going to ahve to come back to though.

    Here's the tough part. You're going to have to figure out which of the two remaining tables, name and username, is the one that that Mambo uses for logins. I'm going to assume that it's username. If so, delete the name table and rename 'name' to user_login and modify it to
    varchar(60). The issue is though we're going to have to populate user_nicename with what's in user_login. I would think best bet would be writing a small php script to go through and read each ID and user_login and save the user_login as user_nicename.

    One last thing. You need a main admin account. In WPMU, usually this is the 'admin' account. Figure out which one you want for this and their ID number (I'm going to use $userID below in replace of this number) and do the following:

    In the wp_usermeta table, create the following records:
    user_id: $userID
    meta_key: primary_blog
    meta_value: 1

    user_id: $userID
    meta_key: source_domain
    meta_value: the url of your setup

    user_id: $userID
    meta_key: wp_1_capabilities
    meta_value: a:1:{s:13:"Administrator";b:1;}

    in wp_sitemeta, edit the following:

    admin_email: the email address of the admin
    admin_user_id: $userID

    Gotta admit that I hope this is right. All this will do is create accounts for your users. They're still going to have to create their own blogs but they won't need to go through registration. They'll login to the WPMU site, and click on the 'Create a new blog' link.

    Good luck,
    -drmike

  6. kernelpanic
    Member
    Posted 17 years ago #

    Thank you for your help.
    your reply has exactly what i wanted... i didn't want to mess with the code. :)

    By the way... there's a fancy component for mambo/joomla websites named comunity builder... it literaly creates another table and manage all fields from there... leaving the fields of mambo original table blank (except for the user id) so i'll try to do a custom install of that component and see what happend.

    I'll let you know how it did after i finish because i'm sure some other guys will like to add blogs to their comunities.

  7. Prophecy
    Member
    Posted 17 years ago #

    Did it work?

    Right now I am trying the same thing.

    Cheers
    Prophecy

  8. Prophecy
    Member
    Posted 17 years ago #

    To drmike:

    I did all you said. But I have one BIG problem. I don't know how to make a php script. Is it possible you can write one? And then post it here. I know that it is much to ask for...

  9. Megalion
    Member
    Posted 16 years ago #

    Going to reactivate this thread since I'm trying to do what Prophecy's doing.

    I've taken the existing user table and mapped it to wp_users. I did a test export/import of 11 users (all are test user accounts I've created before all this)

    Now, I am trying to login to the WPMU installation with their username eg "LolaGirl/mike3333" for user/pass

    The original table used md5 for the password and based on Dr Mike's comments above, I'm assuming that so does WPMU.

    So why doesn't the password work?

    Furthermore, it's occurred to me that an ugly hack of getting around this would be just to make all the users go through the forgotten password process to reset their passwords. The majority of our 12,000+ users are likely to have forgotten their password anyways if they come back. So definitely not an ideal solution but workable.

    So using LolaGirl, I go through the Forgotten Password process. I ended up going through it twice because I didn't realize that clicking the activation link generated a 2nd email containing the new password. (translation: I failed to clearly read the message on the Login page). But the password I got the 2nd time... should work right?

    It doesn't.

    I keep getting "Incorrect Password". But how could this be because WPMU's just ditched the original password and now I'm using standard WPMU procedure to get a working password.

    I even just did it a 3rd time to absolutely sure that I didn't screw it up the 2nd time either.

    And still "Error: Incorrect Password".

    Does anyone have any advice or insight as to how to get this working either via the proper way of properly retaining the user's original password or just at least getting forgotten password to actually work?

    Thanks

  10. theapparatus
    Member
    Posted 16 years ago #

    Did you verify that the correct md5 hash for the password is being saved?

    There's also an issue where folks have to log in directly via the wp-login.php although no one's been able to track that one down or dupe it.

  11. Megalion
    Member
    Posted 16 years ago #

    Actually I finally found the answer elsewhere. The culprit was the fact that I was still on WPMU 1.25a and the username had capital letters which apparently wasn't handled well in that version.

    Upgrading to WPMU 1.3 resolved the initial issue of not being able to login with a freshly imported user. Looks like the same issue is what kept Forgotten Password from working as well.

    It was never the password but the username this whole time.

    But now I can successfully log in with an imported user and I get this now:
    "You do not have sufficient permissions to access this page."

    I see there's quite a few various threads about user permissions but since this is the next logical issue with importing users I'll ask it here.

    When importing users, there is no pre-existing correlation to being subscribed to existing blogs or the user being an Author of his own blog.

    That seems to be the answer as to why I get "not have sufficient permissions". The user has to be set up as a subscriber on at least one blog in WPMU.

    But if they're being imported (or signing up afterwards) as Dr Mike described above (very helpful thank you!) then there's no default subscription in place.

    From what I'm reading, WPMU doesn't have any kind of global subscriber user type that I can set them all to.

    We're going for something like LiveJournal where people have their own blogs and can comment on any public post they want... there is no "subscriptions" but instead "friending" which then links all their friends' blogs into a single feed for them to read.

    Is there such a thing as a global commenter subscriber user? Would it be possible to make a plug in for it if not.. or would it involve hacking WPMU core to remove "by blog" restrictions?

  12. andrea_r
    Moderator
    Posted 16 years ago #

    Well, I'm sur eit's possible, but I'm distracted by one question.. if you're trying to make it LJ-like, why not use their software?

    (right tools for the right job)

  13. Megalion
    Member
    Posted 16 years ago #

    Cause they wanted to use WPMU which is free and I'm more familiar with its code. And at the time, I forgot that LJ's open source and available.

    As things stand, I've got the makings of a plugin that started with someone else's plugin but instead of kicking the user to where they are allowed, it'll automatically give them subscriber/comment access anywhere they go.

    If "not blog user" and "not side admin", subscribe them so they can comment.

    I'll figure out a different way to implement "friending" that's not something we require up front.

    Even the ability to comment isn't required but I have to be able make imported users be able to see something! So if I do it this way, then imported users will automatically get subscribed when they log in for the first time and then to any user blog they visit after that while logged in. 2 birds with one stone.

    So I'm just trying to figure out what to use for the 3rd variable in the "add_user_to_blog()" function. I get the Roles and ability to change what capabilities they have but where are the roles actually identified by number?

  14. Megalion
    Member
    Posted 16 years ago #

    Ahh it's not by number but by name.

    i.e.
    add_user_to_blog($current_blog->blog_id,$user_ID,'subscriber');

  15. agreda
    Member
    Posted 14 years ago #

    I'm planning an MU installation and want to create user accounts for 500+ registered users of an existing blog with Simple:Press discussion forums.

    Is it possible to import these users from the current blog so they can keep the same username and password in the new MU site?

    We're just configuring the new server and planning the new site now, so I haven't had a chance to poke around MU yet. Thanks for any help and advice!

About this Topic

  • Started 17 years ago by kernelpanic
  • Latest reply from agreda