Support » Plugins and Hacks » [Plugin: CSV User Import] no new users added

[Plugin: CSV User Import] no new users added

Viewing 7 replies - 1 through 7 (of 7 total)
  • Same here, WP 3.0.4

    Add me to the list, it failed for me on WP 3.0.4, same success message but no imports.

    Did anyone find a way to make this work? Or a similar plugin that works in 3.04? Thanks!

    Actually, I spoke too soon. It worked for me on 3.04… All my users are there, right off the CSV file.

    I was getting the same problem on WordPress 3.1, but this plugin seemed the best option for the one-off import I needed to do.

    So I did some debugging, and the following fixes sorted it out:

    Line 60: Insert each user – WordPress doesn’t seem to like a string in the table argument – first defining $table_name works. Also my Installatron automatic installed WordPress with NO table prefix! So of course ‘wp-users’ was wrong – I needed ‘users’.

    The following code fixes these two issues:

    $table_name = $wpdb->prefix . 'users';
    $wpdb->insert( $table_name, $arr_user );

    Line 81: Same problem with the user meta insert, code to fix it is:

    $table_name = $wpdb->prefix . 'usermeta';
    $wpdb->insert( $table_name, $arr_meta );

    Line 48: my Excel generated csv file worked with the above fixed, but the email addresses had line feeds after them, hence didn’t work correctly when identifying users or sending emails. A simple trim does the job:

    // firstname, lastname, username, password
    $firstname 		= $arr_values[0];
    $lastname 		= $arr_values[1];
    $username 		= trim($arr_values[2]);
    $password 		= trim($arr_values[3]);
    $user_email 	= trim($arr_values[4]);

    Line 70: the name of the meta value wp_capabilities also seems to be dependent on the table prefix, which as standard is wp_. Mine was actually just ‘capabilities’ though, so the subscriber role was not getting picked up. Here’s the fix:

    // add default meta values
    $arr_meta_values = array(
    					'nickname' => $username,
    					'rich_editing' => "true",
    					'comment_shortcuts' => "false",
    					'admin_color' => "fresh",
    					$wpdb->prefix . 'capabilities' => 'a:1:{s:10:"subscriber";b:1;}',
    					'first_name' => $firstname,
    					'last_name' => $lastname,
    					'default_password_nag' => "1"

    As mentioned elsewhere, I also change the php open tag to be the proper <?php tag.

    I hope that helps, I can share my version if anyone wants it, or if Andy would like to integrate them back into the plugin.

    Plugin Author Andy Dunn


    Thanks for all of that cacaobeans, should help a lot of people out. Ive integrated all of the changes you suggested into the latest version 1.0.3.

    If anyone is having a problem with the old version please download 1.0.3 and see how you get on.


    Sorry to butt-in on a slight tangent here, but if I wanted to import a group of users as something other than ‘subscribers’ (say I had a bunch of folks who were all going to belong to a role I’d created called ‘Junior Admin’, for example) then does anyone know how I might achieve that? Many thanks in advance for any assistance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: CSV User Import] no new users added’ is closed to new replies.