';
echo '
';
echo '
'.__('Add Multiple Users - Manual Entry Form','amulang').'
';
//STEP ONE - SET LINES
if (empty($_POST) || isset($_POST['createnewform'] ) ) {
$manualInputError = '';
amuGenerateManualForm($manualInputError);
//STEP TWO - CREATE FORM
} else if ( isset($_POST['formshow_manual'] ) ) {
amuCreateManualForm();
//STEP THREE - REGISTER USERS
} 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 Manual Entry option from the menu.','amulang').'
';
}
//end wrap divs and function
echo '
';
echo '';
}
/*
* GENERATE FIRST STEP DISPLAY
* provides line number chooser and errors
*/
function amuGenerateManualForm($manualInputError) {
echo '';
//begin form
echo '';
}
/*
* GENERATE MANUAL INPUT FORM
* creates the form for manual input
*/
function amuCreateManualForm() {
global $wpdb;
//get number of lines
$manprocs = $_POST['manualprocs'];
//confirm post is not empty, is a number and is larger than zero
if ($manprocs !== '' && ctype_digit($manprocs) && $manprocs > 0) {
//create dummy arrays
$userArray = array();
$userEntryArray = array();
//push standard values
$userEntryArray['user_login'] = '';
$userEntryArray['user_pass'] = '';
$userEntryArray['user_email'] = '';
//push role value, set if chosen in settings
$theDefRole = get_option('amu_setallroles');
if($theDefRole == 'notset') {
$userEntryArray['role'] = '';
} else {
$userEntryArray['role'] = $theDefRole;
}
//send remaining standard values
$userEntryArray['first_name'] = '';
$userEntryArray['last_name'] = '';
//push remaining standard meta options
$stdamumetaoption = get_option('amu_showblankmeta');
if($stdamumetaoption !== '') {
$stdMetaOptions = json_decode(get_option('amu_showblankmeta'));
foreach($stdMetaOptions as $stdmeta) {
$userEntryArray[$stdmeta->keyname] = '';
}
}
//push custom meta options
$extraamumetaoptions = get_option('amu_extrameta');
if($extraamumetaoptions !== '') {
$extraMetaOptions = json_decode(get_option('amu_extrameta'));
foreach($extraMetaOptions as $extmeta) {
$userEntryArray[$extmeta->keyname] = '';
}
}
//create array of empty arrays
while($manprocs > 0) {
//add blank array as many times as needed
$userArray[] = $userEntryArray;
//decrement
$manprocs--;
}
//send to form creator
$userData = json_encode($userArray);
$source = 'manual';
$newForm = new amuFormCreator($source,$userData);
$newForm->amuCreateFormInterface();
//show form field info
$infotype = 'formfields';
showPluginInfo($infotype);
//error message
} else {
$manualInputError = ''.__('Error: either the number you entered was zero, empty, or a non-numeric character was entered. Please try again.','amulang').'
';
amuGenerateManualForm($manualInputError);
}
}
?>