Example #1
0
function addGeneralOptions()
{
    global $current_user, $wpdb, $wp_roles;
    get_currentuserinfo();
    echo '<div class="toolintro">';
    echo '<h2>' . __('Add Multiple Users - Plugin Settings', 'amulang') . '</h2>';
    echo '<p>' . __('Update settings that affect various plugin functions. Please check the information section at the bottom of this page for more about each setting.', 'amulang') . '</p>';
    echo '</div>';
    echo '<form method="post" enctype="multipart/form-data" class="amuform">';
    echo '<h3>' . __('Validation and Notifications', 'amulang') . '</h3>';
    echo '<div class="genoptionwrap">';
    //send emails...
    echo '<div class="optionbox">';
    echo '	<label for="sendpswemails">' . __('Send each new user a registration notification email?', 'amulang') . '</label>';
    echo '	<input name="sendpswemails" id="sendpswemails" type="checkbox" ';
    //retrieve option if set
    if (get_option('amu_usernotify')) {
        if (get_option('amu_usernotify') == 'yes') {
            echo 'checked="checked"';
        }
    } else {
        echo 'checked="checked"';
    }
    echo ' value="send" />';
    echo '</div>';
    //send confirmation email
    echo '<div class="optionbox">';
    echo '	<label for="confirmEmail">' . __('Email me a complete list of new user account details?', 'amulang') . '</label>';
    echo '	<input name="confirmEmail" id="confirmEmail" type="checkbox" ';
    //retrieve option if set
    if (get_option('amu_confirmation')) {
        if (get_option('amu_confirmation') == 'yes') {
            echo 'checked="checked"';
        }
    } else {
        echo 'checked="checked"';
    }
    echo ' value="yesConfirm" />';
    echo '</div>';
    //validate emails...
    echo '<div class="optionbox">';
    echo '	<label for="validatemail">' . __('Validate entered user_email address format?', 'amulang') . ' <em>(' . __('uses WordPress "is_email" validation method', 'amulang') . ')</em></label>';
    echo '	<input name="validatemail" id="validatemail" type="checkbox" ';
    //retrieve option if set
    if (get_option('amu_validatemail')) {
        if (get_option('amu_validatemail') == 'yes') {
            echo 'checked="checked"';
        }
    } else {
        echo 'checked="checked"';
    }
    echo ' value="validate" />';
    echo '</div>';
    //username strict validation option...
    echo '<div class="optionbox">';
    echo '	<label for="validateStrict">' . __('Sanitize user_login using Strict method?', 'amulang') . ' <em>(' . __('allows only alphanumeric and _, space, ., -, *, and @ characters', 'amulang') . ')</em></label>';
    echo '	<input name="validateStrict" id="validateStrict" type="checkbox" ';
    //retrieve option if set
    if (get_option('amu_validatestrict')) {
        if (get_option('amu_validatestrict') == 'yes') {
            echo 'checked="checked"';
        }
    }
    echo ' value="userstrict" />';
    echo '</div>';
    ////auto-create user names - for version 2.1
    //			echo '<div class="optionbox">';
    //			echo '	<label for="createUserLogin">Auto-create user_login where empty? <em>(prevents registration failure if user_login is missing)</em></label>';
    //			echo '	<input name="createUserLogins" id="createUserLogins" type="checkbox" ';
    //			//retrieve option if set
    //			if (get_option('amu_createuserlogins')) {
    //				if ( get_option('amu_createuserlogins') == 'yes') {
    //					echo 'checked="checked"';
    //				}
    //			}
    //			echo ' value="usercreatelogin" />';
    //			echo '</div>';
    //force fill emails...
    echo '<div class="optionbox lastoption">';
    echo '	<label for="forcefillemail">' . __('Force Fill empty user_email addresses?', 'amulang') . ' <em>(' . __('not recommended - see bottom of page for details', 'amulang') . ')</em></label>';
    echo '	<input name="forcefillemail" id="forcefillemail" type="checkbox" ';
    //retrieve option if set
    if (get_option('amu_forcefill')) {
        if (get_option('amu_forcefill') == 'yes') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" />';
    echo '</div>';
    echo '</div>';
    //set default user role option
    echo '<h3>' . __('New User Defaults and Overrides', 'amulang') . '</h3>';
    echo '<div class="genoptionwrap">';
    echo '<div class="optionbox">';
    //set all users to this role
    if (get_option('amu_setallroles')) {
        $rolesel = get_option('amu_setallroles');
    } else {
        $rolesel = 'notset';
    }
    $roles = $wp_roles->get_names();
    echo '	<label for="allToRole">' . __('Ignore individual User Role settings and set all new users to this role', 'amulang') . ': </label>';
    echo '	<select name="allToRole" id="allToRole">';
    echo '		<option value="notset"';
    if ($rolesel == 'notset') {
        echo ' selected="selected" ';
    }
    echo '>' . __('no, set individually...', 'amulang') . '</option>';
    foreach ($roles as $role) {
        $thisrole = $role;
        echo '<option value="' . strtolower($thisrole) . '"';
        if (strtolower($rolesel) == strtolower($thisrole)) {
            echo ' selected="selected" ';
        }
        echo '>' . $thisrole . '</option>';
    }
    echo '	</select>';
    echo '</div>';
    //set display name option
    if (get_option('amu_dispnamedef')) {
        $defaultDispName = get_option('amu_dispnamedef');
    } else {
        $defaultDispName = 'userlogin';
    }
    echo '<div class="optionbox lastoption">';
    echo '	<label for="defaultdispname">' . __('Where not provided, set new user Display Name preference as', 'amulang') . ':</label>';
    echo '	<select name="defaultdispname" id="defaultdispname">';
    echo '		<option value="userlogin"';
    if ($defaultDispName == 'userlogin') {
        echo ' selected="selected" ';
    }
    echo '>' . __('User Login', 'amulang') . '</option>';
    echo '		<option value="firstname"';
    if ($defaultDispName == 'firstname') {
        echo ' selected="selected" ';
    }
    echo '>' . __('First Name', 'amulang') . '</option>';
    echo '		<option value="lastname"';
    if ($defaultDispName == 'lastname') {
        echo ' selected="selected" ';
    }
    echo '>' . __('Last Name', 'amulang') . '</option>';
    echo '		<option value="firstlast"';
    if ($defaultDispName == 'firstlast') {
        echo ' selected="selected" ';
    }
    echo '>' . __('First then Last Name', 'amulang') . '</option>';
    echo '		<option value="lastfirst"';
    if ($defaultDispName == 'lastfirst') {
        echo ' selected="selected" ';
    }
    echo '>' . __('Last then First Name', 'amulang') . '</option>';
    echo '		<option value="nickname"';
    if ($defaultDispName == 'nickname') {
        echo ' selected="selected" ';
    }
    echo '>' . __('Nickname', 'amulang') . '</option>';
    echo '	</select>';
    echo '</div>';
    echo '</div>';
    //set default sorter preference
    echo '<h3>' . __('CSV Column Ordering', 'amulang') . '</h3>';
    echo '<div class="genoptionwrap">';
    echo '<div class="optionbox">';
    //column ordering preference
    $colpref = get_option('amu_colorderpref');
    echo '	<label for="sorterpreference">' . __('Choose which method of column ordering you would like to use', 'amulang') . ': </label>';
    echo '	<select name="sorterpreference" id="sorterpreference">';
    echo '		<option value="dynamic"';
    if ($colpref == 'dynamic') {
        echo ' selected="selected" ';
    }
    echo '>' . __('Dynamic Sorting on Import', 'amulang') . '</option>';
    echo '		<option value="predefined"';
    if ($colpref == 'predefined') {
        echo ' selected="selected" ';
    }
    echo '>' . __('Predefined Below', 'amulang') . '</option>';
    echo '		<option value="static"';
    if ($colpref == 'static') {
        echo ' selected="selected" ';
    }
    echo '>' . __('Manual Entry on Import', 'amulang') . '</option>';
    echo '		<option value="firstline"';
    if ($colpref == 'firstline') {
        echo ' selected="selected" ';
    }
    echo '>' . __('Use First Line of CSV', 'amulang') . '</option>';
    echo '	</select>';
    echo '</div>';
    //predefined sort order value
    $sortpredef = get_option('amu_colorderpredef');
    echo '<div class="optionbox lastoption">';
    echo '	<label for="sortorderpredef">' . __('Predefined column order to use when importing CSV data', 'amulang') . ' <em>(' . __('no spaces, separate with commas', 'amulang') . ')</em>: </label>';
    echo '	<input type="text" name="sortorderpredef" id="sortorderpredef" value="';
    if ($sortpredef !== '') {
        $sortpredeffields = json_decode($sortpredef);
        $newSortPrefArr = array();
        foreach ($sortpredeffields as $pso) {
            $newSortPrefArr[] = $pso->keyname;
        }
        $printablePSO = implode(',', $newSortPrefArr);
        echo $printablePSO;
    }
    echo '" />';
    amuColumnNamesHint();
    echo '</div>';
    echo '</div>';
    //meta data customisation
    echo '<h3>' . __('Manual Entry User Meta Data', 'amulang') . '</h3>';
    echo '<div class="genoptionwrap">';
    //show additional meta options on blank form
    echo '<div class="optionbox metaoptionbox">';
    echo '	<p>' . __('Make additional WordPress Standard meta data fields available on Form interface', 'amulang') . ':</p>';
    $blankmeta = get_option('amu_showblankmeta');
    if ($blankmeta !== '') {
        $blanksettings = json_decode(get_option('amu_showblankmeta'));
    } else {
        $blanksettings = array('none' => 'noextras');
    }
    echo '	<span>' . __('User Url', 'amulang') . ': <input name="meta_user_url" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'user_url') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Nicename', 'amulang') . ': <input name="meta_user_nicename" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'user_nicename') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Nickname', 'amulang') . ': <input name="meta_nickname" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'nickname') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Display Name', 'amulang') . ': <input name="meta_displayname" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'display_name') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('User Registered', 'amulang') . ': <input name="meta_userregistered" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'user_registered') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Description', 'amulang') . ': <input name="meta_description" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'description') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Admin Bar Front', 'amulang') . ': <input name="meta_barfront" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'show_admin_bar_front') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Rich Editing', 'amulang') . ': <input name="meta_richedit" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'rich_editing') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Comment Shortcuts', 'amulang') . ': <input name="meta_comshort" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'comment_shortcuts') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Admin Color', 'amulang') . ': <input name="meta_admincolor" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'admin_color') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('AIM', 'amulang') . ': <input name="meta_aim" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'aim') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Yahoo IM', 'amulang') . ': <input name="meta_yim" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'yim') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '	<span>' . __('Jabber', 'amulang') . ': <input name="meta_jabber" type="checkbox"';
    foreach ($blanksettings as $setting) {
        if ($setting->keyname == 'jabber') {
            echo 'checked="checked"';
        }
    }
    echo ' value="fill" /></span>';
    echo '</div>';
    //additional meta fields
    $extrameta = get_option('amu_extrameta');
    echo '<div class="optionbox lastoption">';
    echo '	<label for="additionalmeta">' . __('Make additional custom meta fields available on Form interface', 'amulang') . ' <em>(' . __('no spaces, separate with commas', 'amulang') . ')</em>: </label>';
    echo '	<input type="text" name="additionalmeta" id="additionalmeta" value="';
    if ($extrameta !== '') {
        $extraMetaFields = json_decode($extrameta);
        $newExtraMetaArr = array();
        foreach ($extraMetaFields as $emf) {
            $newExtraMetaArr[] = $emf->keyname;
        }
        $printableEMA = implode(',', $newExtraMetaArr);
        echo $printableEMA;
    }
    echo '" />';
    echo '</div>';
    echo '<p><span class="important">' . __('Standard and Custom meta options you define here will be available on the Form using the Manual Entry function or when creating a user information form from the Import Email List function.', 'amulang') . '</span></p>';
    echo '</div>';
    echo '<h3>' . __('Customize New User Notification Email', 'amulang') . '</h3>';
    echo '<div class="genoptionwrap emailcustbox">';
    //customize new user delivered email
    echo '<div class="optionbox lastoption">';
    $msghead = get_option('amu_useremailhead');
    $msgtext = get_option('amu_useremailtext');
    $sendemailsto = get_option('amu_defadminemail');
    $siteloginurl = get_option('amu_siteloginurl');
    echo '<div class="optioninstructions">';
    echo '	<p><strong>' . __('Use the following settings to modify the notification email that new users receive when added via the plugin.', 'amulang') . '</strong></p>';
    echo '	<p>' . __('Please refer to the Information about Settings options at the bottom of this page for more information about these settings.', 'amulang') . '</p>';
    echo '	<p>' . __('Valid shortcodes are', 'amulang') . ': [sitename] [siteurl] [siteloginurl] [username] [password] [useremail] [fromreply]</p>';
    echo '</div>';
    //from email
    echo '<div class="optionbox">';
    echo '<label for="custademail" class="custheadlabel">' . __('From/Reply Address', 'amulang') . ': </label>';
    echo '<input type="text" name="custademail" id="custademail" value="' . $sendemailsto . '" class="custheadfield" />';
    echo '</div>';
    //custom login url
    echo '<div class="optionbox">';
    echo '<label for="custlogurl" class="custheadlabel">' . __('Site Login URL', 'amulang') . ': </label>';
    echo '<input type="text" name="custlogurl" id="custlogurl" value="' . $siteloginurl . '" class="custheadfield" />';
    echo '</div>';
    //message header
    echo '<div class="optionbox">';
    echo '<label for="custemailhead" class="custheadlabel">' . __('Email Subject', 'amulang') . ': </label>';
    echo '<input type="text" name="custemailhead" id="custemailhead" value="' . $msghead . '" class="custheadfield" />';
    echo '</div>';
    //message text
    echo '<div class="optionbox lastoption">';
    echo '<label for="customemailtext" class="custheadlabel">' . __('Email Message (HTML format)', 'amulang') . ': </label>';
    echo '<textarea name="customemailtext" cols="50" rows="10" id="customemailtext" class="textfillbox">' . $msgtext . '</textarea>';
    echo '</div>';
    echo '</div>';
    //add dynamic emailer button to customisation box for testing email
    echo '<input type="button" name="testCustomEmail" id="testCustomEmail" class="button-primary button-right" value="' . __('Send Test Email', 'amulang') . '" />';
    echo '<p><span class="important">' . __('Test emails will be sent to your administrator email.', 'amulang') . '</span></p>';
    echo '</div>';
    echo '<div class="buttonline">';
    echo '	<input type="submit" name="setgenopt" id="setgenopt" class="button-primary" value="' . __('Save Settings', 'amulang') . '" />';
    echo '	<input type="submit" name="resetsettings" id="resetsettings" class="button-primary" value="' . __('Reset to Default Settings', 'amulang') . '" />';
    echo '</div>';
    echo '</form>';
}
Example #2
0
function amuAddFileSort()
{
    global $wpdb;
    //show data appropriate to chosen sorting method
    $getSortOrderPref = get_option('amu_colorderpref');
    //if dynamic, show box to fill with jquery stuff
    if ($getSortOrderPref == 'dynamic') {
        include 'dynamicsorter.php';
        //if predefined, show predefined structure
    } else {
        if ($getSortOrderPref == 'predefined') {
            echo '<p><span class="important">' . __('You have predefined your CSV data column order as the following', 'amulang') . ':<br /><strong>';
            $sortpredef = get_option('amu_colorderpredef');
            if ($sortpredef !== '') {
                $sortpredeffields = json_decode($sortpredef);
                $newSortPrefArr = array();
                foreach ($sortpredeffields as $pso) {
                    $newSortPrefArr[] = $pso->keyname;
                }
                $printablePSO = implode(',', $newSortPrefArr);
                echo $printablePSO;
            } else {
                _e('No column order has been defined! Please see the Settings page to specify your column order.', 'amulang');
            }
            echo '</strong><br />' . __('Ensure that where standard WordPress values are being used that your column names match the wp_user or wp_usermeta tables.', 'amulang') . '</p>';
            //if static, provide box to type in structure
        } else {
            if ($getSortOrderPref == 'static') {
                echo '<div class="genoptionwrap">';
                echo '<div class="optionbox lastoption">';
                echo '<label for="loadorderpref">' . __('Specify your CSV column order here', 'amulang') . ' <em>(' . __('no spaces, separate with commas', 'amulang') . ')</em>:</label>';
                echo '<input type="text" name="loadorderpref" id="loadorderpref" value="" />';
                amuColumnNamesHint();
                echo '</div>';
                echo '</div>';
                //if using firstline, notify of choice
            } else {
                if ($getSortOrderPref == 'firstline') {
                    echo '<p><span class="important"><strong>' . __('Your Column Order Preference is currently set to read the first line of your CSV data as the column order. This line has been included in your CSV data to modify if necessary.', 'amulang') . '</strong>';
                    amuColumnNamesHint();
                }
            }
        }
    }
}