Bulk Member Import

I recently requested support for a method of importing/assigning membership/subscriptions from a CSV import. David suggested I open a new thread to walk through issues encountered.

We are NOT using multi-site (at present but we plan to on the next iteration) but we are running BuddyPress.

First, the good news - we were able to create a basic php script to (successfully) import all 12,000 members with accurate subscription/membership options. If you'd like it, you can download it from here. Hopefully it'll grow up to be a plugin or membership option some day.

The only problem we've encountered (so far) is with site users with admin permissions not being able to add new users even if they have privileges to edit Membership settings or, if they didn't have membership edit privileges, being able to access the dashboard overall.

I've read through the installation instructions and don't see anything obvious that I've missed and searching the forum didn't bring anything specific up, so perhaps someone can explain what I'm missing there?

Many thanks!

Sue

  • DavidM
    • DEV MAN’s Mascot

    Hi Sue,

    That's just awesome, I'll mention this to a few of the developers who I think would find this very interesting!

    As for the capabilities issue though, I noticed the following with a quick, cursory view of the file:

    // We are presuming all moved members are subscribers only
    $query17 = <<<Q17
    insert into wp_usermeta set user_id='$userid', meta_key='wp_capabilities', meta_value='a:1:{s:10:"subscriber";s:1:"1";}'
    Q17;

    Is there elsewhere you recall a different role being added for Admins? I only did a quick view of it so I may have missed it.

    -David

  • Mason
    • DEV MAN’s Sidekick

    Hiya suecline,

    Apologies for the delay here, were you ever able to get this one sorted? If all imports are being given the level of 'subscriber' they wouldn't have the capabilities required to add a new user.

    Or are you saying that even your admins do not have the ability to add users? I'm not sure that Membership will allow someone to add a user simply because they can see this sub-menu item. Is that the way you have it setup? Seems to me they will still need the user capability.

    You can add this to the subscriber role (again, if that's your desire) by using another plugin such as role scoper or members: http://wordpress.org/extend/plugins/members

    Hope this helps.

    Thanks!

  • Arun Basil Lal
    • New Recruit

    Hello suecline,

    I wonder if the issue has been resolved yet. Our apologies for not getting back to you in time, but did you figure it out?

    I am gonna go ahead and mark this as resolved for now, but if you still need support let me know and feel free to re-open this thread. I can get you help!

    Arun Basil Lal

  • suecline
    • Site Builder, Child of Zeus

    Arun,

    We have not yet gotten the issue resolved, I just had to move onto other problems.

    The issue as of right now is that we are having to give all users "super admin" privileges in order for them to do the basic stuff - author roles, for example, can't get into the dashboard at all, much less author a new post.

    Any assistance would be greatly appreciated.

    Thanks!

    Sue

  • suecline
    • Site Builder, Child of Zeus

    Arun,

    Thanks for the suggestion. We were previously using Advanced Role Manager, but I've deactivated that and swapped in Members to see if it helps any.

    The big problem that I don't think was very clear is that I already have roles laid out for people, following the standard WP defined roles & capabilities to mesh with what the organization needs.

    What is happening, however, is that if the premium membership plugin is turned on, all roles *except* super admin become null - unless you are a super admin, you can't even get to the dashboard.

    So, for example, a person with the role of author is supposed to be able to author a post, but with membership on, that person can't even get to the dashboard to write a post, much less pass it up the food chain to the editor.

    Is that more clear?

    Thanks -

    Sue

  • Barry
    • DEV MAN’s Mascot

    What is happening, however, is that if the premium membership plugin is turned on, all roles *except* super admin become null - unless you are a super admin, you can't even get to the dashboard.

    That certainly shouldn't happen, at what stage does it look like they are losing their roles?

  • suecline
    • Site Builder, Child of Zeus

    Barry,

    I'm not sure what you mean by at what stage do they lose their roles - if membership is on, they are essentially subscribers.

    Here are a couple of screenshots:

    With a user with the role of author, here is the exterior of the site with membership on:

    <img src="http://www.suecline.com/wp-content/uploads/2012/03/memberOn.jpg" alt="" title="memberOn" width="771" height="645" class="alignleft size-full wp-image-412" />
    Note, there is no way for a new/inexperienced user to migrate themselves to the dash at wp-admin.

    Since I do know how to get there, here is a screenshot of what someone with the author role sees when they're logged in:

    <img src="http://www.suecline.com/wp-content/uploads/2012/03/membershipOn-1024x703.jpg" alt="" title="membershipOn" width="640" height="439" class="alignleft size-large wp-image-413" />

    The role manager appears to be echoing what I think about the capabilities an author should have:

    <img src="http://www.suecline.com/wp-content/uploads/2012/03/rolesManager-1024x253.jpg" alt="" title="rolesManager" width="640" height="158" class="alignleft size-large wp-image-415" />

    I checked the 23 capabilities, which included deleting pages (which, if you can't see them, you can't do) and other assorted goodies.

    What I do know is that before I imported all those members, my roles & capabilities worked fine. Once I added it, it all went haywire and only "super admins" can create posts or pages, add users etc. Complicating things is that even turning membership off doesn't revert roles to a pre-import state.

    The problem is that I don't want 36 admins, I want 3. I've had to bump so many people up to work around the plugin, when one of the advantages we'd hoped to take advantage of in WP was role management. Now I have volunteers with access to the membership and event system - that's a big problem for the organization.

    Hope this helps clarify the situation!

    Thanks -

    Sue

  • Barry
    • DEV MAN’s Mascot

    I'm not sure what you mean by at what stage do they lose their roles - if membership is on, they are essentially subscribers.

    I mean, if you create a user then what can they see? and at what point do they lose those initial rights? Is it when you assign them to a membership subscription? or add them to a level? Membership doesn't touch roles unless you have specified what roles you want users to be assigned to for a specific level or subscription, and then only if you have activated the WP roles integration add-on.

    So, I'm trying to think through what is happening during the lifetime of a user and thus work out what bit of code could be affecting the roles.

  • suecline
    • Site Builder, Child of Zeus

    Well, funny enough, I think I resolved the whole darn problem by turning on the Default BuddyPress Rules - the minute I did that, logged out and logged back in, my fake author profile had just about the access I assumed they would have (see the plain jane install shot above, same outcome).

    I am a little concerned that it automatically activated me as a paid member (the association has a mix of free, basic, sustaining and lifetime members) but that really isn't related to this issue.

    So - my summary is that something in the script we used horked existing user permissions weirdly (please check that before you include the script we wrote in the next release).

    The solution is to delete all the existing admin accounts and manually recreate them, being sure to define the roles carefully using the members plugin Mason mentions above (http://wordpress.org/extend/plugins/members). Once that is done, change their subscription levels so unpaid members don't get member benefits.

    Thanks for taking the time to walk me through how to think about this!

    Sue

  • KevinDLyons
    • Flash Drive

    Sue,

    I'm walking in your footsteps needing to import only 260 users to BuddyPress/Membership. Did you do any modifications to your script (thanks for posting) or is it the same version that you ended up using?

    I will probably hand sculpt stuff in the MySQL but will use your script as a bulk starting point.

    Thanks!
    Kevin

  • suecline
    • Site Builder, Child of Zeus

    Kevin,

    That script has worked without modification on 3 different bulk imports (50,000 member imports and counting). If you run into any trouble with it, do let me know as we do support that script!

    We also did some manual mySQL work to redefine roles, but as far as moving lots of members, it works just like it says on the tin :wink:

    Best of luck to you!

    Sue

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.