WordPress.org

Ready to get started?Download WordPress

Forums

Import Users from CSV
[resolved] Importing new/existing users from another system (5 posts)

  1. joozef
    Member
    Posted 1 year ago #

    Hi,

    Thank for you creating a great plugin - for free!

    My client's business uses a CRM system that employees use in their office. They would like to synchronise their members' accounts from the CRM with their WP 3.4.2 website - with all members having a Subscriber role.

    The plan is to export member records from the CRM system to a CSV and hopefully use your plugin to import the records into the WP website. The CSV file can contain both new and existing users with updated fields.

    Problems:-

    1. Updating existing users requires an "ID" field in the file. We would like to use the "ID" field from their CRM for new records however, if it is a new record for WP and an "ID" is supplied, the plugin expects to update a record - not try to import one and so nothing happens. We need to have a consistent file structure so the export can be automated.

    2. We would like to be able to import the file using a carefully crafted URL if possible so it can be done automatically via a script on a schedule.

    Can you help with these two problems?

    Thanks in advance

    http://wordpress.org/extend/plugins/import-users-from-csv/

  2. cynnie88
    Member
    Posted 1 year ago #

    If you are importing from another wordpress database, why are you taking the extra step of converting to csv? Why not just clone the table?

  3. joozef
    Member
    Posted 1 year ago #

    Hi cynnie88,

    I am not import from another WordPress database. It is a CRM system provided by a third party used in the client's office.

    Thanks

  4. cynnie88
    Member
    Posted 1 year ago #

    Ok I completely misunderstood.

  5. Ulrich Sossou
    Member
    Plugin Author

    Posted 1 year ago #

    You will need to write some code for that. Fortunately, the plugin is sufficiently flexible, so there isn't much to write.

    For problem 1, store the ID from the CRM system in user meta. Then filter out during plugin import to match with WordPress ID. Something like:

    function custom_match_ids( $userdata, $usermeta ) {
        $users = get_users( array(
            'meta_key' => 'crm_id', // supposing the CRM ID is stored in crm_id field
            'meta_value' =>$usermeta['crm_id']
        ) );
    
        if ( $users )
            $userdata['ID'] = $users[0]->ID;
    
        return $userdata;
    }
    add_filter( 'is_iu_import_userdata', 'custom_match_ids', 10, 2 );

    For problem 2, see http://wordpress.org/support/topic/plugin-import-users-from-csv-import-via-cron-event

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic