Check for duplicate email when importing

Discussion in 'Customization & add-ons' started by jazzedge, Nov 27, 2007.

  1. jazzedge

    jazzedge Member

    Joined:
    Aug 11, 2007
    Messages:
    54
    I had to import a list of users and wanted to filter out by email address AND by login. So, if their email address was found, they would not get imported.

    I added this code to amember/admin/import.php

    I place it here for anyone who can use it. Use at own risk / backup first :)

    Code:
      //added wmyette 11-27-2007 to filter out duplicate email addresses
      
    		if (!$db->users_find_by_string($r['email'], 'email', 1)){
    		//original code-->	
    			if (!$db->check_uniq_login($r['login'])){
    				print "Duplicate login: $r[login]. This record won't be imported<br />";
    				continue;
    			}
    		//end original code
    		} else {
    			print "Duplicate email: $r[email]. This record won't be imported<br />";
    			continue;
    		}
      
  2. webmonkeys

    webmonkeys New Member

    Joined:
    Aug 3, 2008
    Messages:
    12
    what a great snippet. thank you.

Share This Page