'; echo '

'.__('New User Accounts Processed.','amulang').'

'; echo '
'; amuProcessEmailInput('direct'); // REGISTER FROM FORM } else if( isset($_POST['addnewusers'] ) ){ echo '
'; echo '

'.__('New User Accounts Processed.','amulang').'

'; echo '
'; amuRegisterFromForm(); //OTHERWISE, UNKNOWN REQUEST HANDLER } else { echo '

'.__('Unknown request. Please choose the Import Email List option from the menu.','amulang').'

'; } ?>
'.__('Error: No valid email addresses were found in your input data! Please try again.','amulang').'

'; addByEmailList($emailListError); $infotype = 'emaillisting'; showPluginInfo($infotype); } else { //new array for user data $userArray = array(); $emailListArray = explode(',',$cleanEmailList); foreach($emailListArray as $userEntry) { //create username/email vars $em_useremail = $userEntry; $pos = strpos($em_useremail, '@'); $em_username = substr($em_useremail, 0, $pos); //verify is email address if($pos !== false) { $userEntryArray = array(); //push some values plus some dummy ones $userEntryArray['user_login'] = $em_username; $userEntryArray['user_pass'] = ''; $userEntryArray['user_email'] = $em_useremail; //push role variable if it exists $theDefRole = get_option('amu_setallroles'); if($theDefRole == 'notset') { $userEntryArray['role'] = ''; } else { $userEntryArray['role'] = $theDefRole; } if($regType == 'form') { //send some other ones $userEntryArray['first_name'] = ''; $userEntryArray['last_name'] = ''; //add selected standard values $stdamumetaoption = get_option('amu_showblankmeta'); if($stdamumetaoption !== '') { $stdMetaOptions = json_decode(get_option('amu_showblankmeta')); foreach($stdMetaOptions as $stdmeta) { $userEntryArray[$stdmeta->keyname] = ''; } } //add custom meta options $extraamumetaoptions = get_option('amu_extrameta'); if($extraamumetaoptions !== '') { $extraMetaOptions = json_decode(get_option('amu_extrameta')); foreach($extraMetaOptions as $extmeta) { $userEntryArray[$extmeta->keyname] = ''; } } } //add this entry array to full user data array $userArray[] = $userEntryArray; //kill it for reuse unset($userEntryArray); } } //encode full user array $userData = json_encode($userArray); //send to form creator if($regType == 'form') { $source = 'email'; $newForm = new amuFormCreator($source,$userData); $newForm->amuCreateFormInterface(); //show form field info $infotype = 'formfields'; showPluginInfo($infotype); //or process direct } else if($regType == 'direct') { $eachUserData = json_decode($userData); $confirmationStack = array(); $line = 0; foreach($eachUserData as $userRow) { $line++; if($userRow->user_login !== '') { //create new user object $newUser = new amuUserObject($userRow); //register initial user info $newid = $newUser->amuRegisterUser(); if(is_int($newid)) { //update users data based on input $newUser->amuUpdateUserData(); //send user a notification email $newUser->amuSendUserEmail(); //set confirmation message $confirmUpdate = '

'.$line.'. '.__('New user successfully registered.','amulang').' '.__('Login','amulang').': '.$newUser->user_login.' '.__('Password','amulang').': '.$newUser->user_pass.' '.__('Email','amulang').': '.$newUser->user_email.'

'; } else { //return failure message $confirmUpdate = '

'.$line.'. '.$newid.'

'; } //kill reusable object unset($newUser); } else { //return failure message $confirmUpdate = '

'.$line.'. '.__('No user_login was found. This line was skipped.','amulang').'

'; } //add success or failure message to stack $confirmationStack[] = $confirmUpdate; } echo '

'.__('Results of your new user registrations','amulang').'

'; //admin notifications $adminUser = new amuAdminObject(); $sendRegResults = $adminUser->amuAdminConfirmation($confirmationStack); $stackDisplay = $adminUser->amuShowStack($confirmationStack); //print notifications to screen echo $sendRegResults; echo '
'.$stackDisplay.'
'; //or throw error } else { echo '

'.__('Unknown request.','amulang').'

'; } } } else { $emailListError = '

'.__('Error: No valid email addresses were found in your input data! Please try again.','amulang').'

'; addByEmailList($emailListError); $infotype = 'emaillisting'; showPluginInfo($infotype); } } /* * EMAIL LIST SUBMISSION INTERFACE * prints interface for adding email data and choosing reg options */ function addByEmailList($emailListError) { ?>

get_amu_emailsetallroles(); echo $csvinfo->get_updatenow(); ?>