How to prevent Batch Create from adding user to main blog?

I'm using Batch Create to set up student blogs in a Multisite install. My ultimate goal is to assign each student user to a role I created with Capability Manager. In order to do this, I have to do two separate imports: the first time with the role "administrator", and then second with the role "studentadmin".

That part is working fine. The problem is that the second import also results in the user being added to the main blog for the site, with that role.

The log shows this:

2013-09-26 02:31:43 [debug] - User bommisi17 already exists (ID: 270)
2013-09-26 02:31:43 [debug] - Blog (studentweb.d102.org) already exists (262), user can be added
2013-09-26 02:31:43 [debug] - User bommisi17 successfully added to blog studentweb.d102.org/bommisi17/
2013-09-26 02:31:43 [debug] - There was no explicitly requested blogs; adding user to main blog

I'm not sure, but from what I can tell, this was an issue in core that was fixed in 3.6.1 (which I'm running), so I'm wondering if there is something else going on in the Batch Create plugin.

  • PC

    Hey Tom,

    Thanks for posting on the forums.

    This is the default behavior on Multisite and is a much asked question. However it can be handled by using something like : https://premium.wpmudev.org/forums/topic/how-do-i-remove-top-bar-access-to-master-site-for-simple-users-in-wpmu

    You can also try and use a plugin like : http://wordpress.org/plugins/multisite-user-management/ and set no role for the main site and see if that helps.

    Please advise.

    Cheers
    PC
    Sales &Support

  • tom_donovan

    PC:

    I can see what you're saying, but I'm still puzzled. What I'm seeing is the user being added to the main site not when first imported but when I do a second import where the row in the import file has a different role for that user. In other words, the user is added to the main site by the batch import when the user and blog already exist.

    Here is the log. First import, user is new, blog does not exist:

    2013-09-26 02:29:14 [debug] - --- Starting queue item processing ---
    	Blog name: [bommisi17]
    	User name: [bommisi17]
    2013-09-26 02:29:14 [debug] - User: bommisi17 created!
    2013-09-26 02:29:14 [debug] - Blog (studentweb.d102.org) does NOT exist yet
    2013-09-26 02:29:14 [debug] - Starting new blog creation
    2013-09-26 02:29:14 [debug] - New user is administrator
    2013-09-26 02:29:14 [debug] - Attempting to create a new blog with this data:
    	Domain: [studentweb.d102.org]
    	Path: [/bommisi17/]
    	Title: [Sindhu B.]
    	Admin user ID: [270]
    	On site: [1]
    2013-09-26 02:29:14 [debug] - Blog: studentweb.d102.org/bommisi17/ created!
    2013-09-26 02:29:14 [debug] - --- Queue item processing finished ---

    Perfect. User created, new blog added, & user assigned as administrator. The only missing piece is that I want students to have a different role. So I do a second import, with a different value in the "role" column of my spreadsheet. Here is the log for this second import. Note the second to last line:

    2013-09-26 02:31:43 [debug] - --- Starting queue item processing ---
    	Blog name: [bommisi17]
    	User name: [bommisi17]
    2013-09-26 02:31:43 [debug] - User bommisi17 already exists (ID: 270)
    2013-09-26 02:31:43 [debug] - Blog (studentweb.d102.org) already exists (262), user can be added
    2013-09-26 02:31:43 [debug] - User bommisi17 successfully added to blog studentweb.d102.org/bommisi17/
    2013-09-26 02:31:43 [debug] - There was no explicitly requested blogs; adding user to main blog
    2013-09-26 02:31:43 [debug] - --- Queue item processing finished ---

    It seems like I'm experiencing something similar to what this thread refers to as being fixed two days ago:

    https://premium.wpmudev.org/forums/topic/batch-create-plugin-doesnt-seem-to-recognize-and-assign-users-to-already-created-blogs

    I updated to 1.3.2 before I started doing the imports (and am running WP 3.6.1).

  • PC

    Hey Tom,

    Thanks for posting back and for the detailed information.

    The issue at the other thread is resolved from what I tested last.

    I need to run a full test in order to see what might be going on there. Can you kindly share the csv or xls files you are using for first and second import ?

    So in the first import you are importing users and creating blogs and then in the second you are trying to change their roles ? right ?

    Please advise.

    Cheers
    PC
    Sales &Support

  • tom_donovan

    So in the first import you are importing users and creating blogs and then in the second you are trying to change their roles ? right ?

    Right. For some reason, I can't do the initial import using the role I want, so I discovered that by doing it in two passes, it would work, with the only problem being the addition of the user to the main blog.

    Attached are two files, the only difference between them is that the first imports the user with role "administrator", while the second has the role "studentadmin". The latter is a role I created in the template site using Capability Manager Enhanced. Because I'm just beginning the process, I am testing with a single user so the files only contain one record to import.

    [Update] Can't upload .xls files to I converted to CSV. I did the imports with XLS, though, starting with the template provided w. the plugin.

  • PC

    Hey there Tom,

    Thanks for posting back.

    As I visualized it, if you are creating a new site with a user, the user would go as an admin as every site needs an admin.

    So what about the below approach.

    As you would be changing the student user role to a custom role, what about creating the sites with your admin username so that you are added as an admin to the sites and then adding the users with custom role to the sites ?

    That ways you would not have to change the role of the subsite admins.

    Please advise if that would work.

    Cheers
    PC
    Sales &Support