Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Just a warning for anyone – the register and lost password links were switched off by default – EVEN if they were showing as ticked in the widget. I had to switch them off, save, and switch them back on to make them work. Might just be my site, but worth looking out for!

    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.

Viewing 2 replies - 1 through 2 (of 2 total)