function aeu_addfromsite()
{
    //test again for admin priviledges
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    //set network options if they don't exist
    amu_set_default_network_options();
    //test if disabled by superadmin
    if (is_multisite()) {
        if (get_site_option('amu_subadminaccess')) {
            if (get_site_option('amu_subadminaccess') == 'no') {
                if (!current_user_can('manage_network')) {
                    wp_die(__('Access to AMU functions have been disabled by the Network Administrator.'));
                }
            }
        }
    }
    //test if disabled by superadmin
    if (is_multisite()) {
        if (get_site_option('amu_addexistingaccess')) {
            if (get_site_option('amu_addexistingaccess') == 'no') {
                if (!current_user_can('manage_network')) {
                    wp_die(__('Access to this function has been disabled by the Network Administrator.'));
                }
            }
        }
    }
    //when accessing amu, set options if they don't exist
    amu_set_defaultoptions();
    //begin wrap class
    echo '<div class="wrap">';
    echo '<div id="amu">';
    echo '<h2>' . __('Add Multiple Users - Add from Site', 'amulang') . '</h2>';
    if (!isset($_GET['site_id'])) {
        //select site first to get user list
        aeuShowSites();
    } else {
        aeuShowSites($_GET['site_id']);
        //if no post made, show interface and helpers
        if (empty($_POST)) {
            $userListError = '';
            amuGetUserListHead($userListError);
            aeuShowSiteUsers($_GET['site_id']);
            $infotype = 'addexistusers';
            showPluginInfo($infotype);
            //otherwise, run add existing function
        } else {
            if (isset($_POST['addexistingusers'])) {
                amuAddNetworkUsers();
                //else throw error
            } else {
                echo '<p>' . __('Unknown request. Please select the Add from Network option to try again.', 'amulang') . '<p>';
                echo '<pre>' . print_r($_POST, true) . '</pre>';
            }
        }
    }
    echo '</div>';
    echo '</div>';
}
Example #2
0
function amu_settings()
{
    //test again for admin priviledges
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    //set network options if they don't exist
    amu_set_default_network_options();
    //test if disabled by superadmin
    if (is_multisite()) {
        if (get_site_option('amu_subadminaccess')) {
            if (get_site_option('amu_subadminaccess') == 'no') {
                if (!current_user_can('manage_network')) {
                    wp_die(__('Access to AMU functions have been disabled by the Network Administrator.'));
                }
            }
        }
    }
    //when accessing amu, set options if they don't exist
    amu_set_defaultoptions();
    //globals for functions
    global $current_user, $wpdb;
    get_currentuserinfo();
    $thisUserEmail = $current_user->user_email;
    $thisBlogName = get_bloginfo('name');
    $thisBlogUrl = site_url();
    $thisLoginUrl = get_option('amu_siteloginurl');
    //begin wrap class
    echo '<div class="wrap">';
    echo '<div id="amu">';
    //if saving options...
    if (isset($_POST['setgenopt'])) {
        setGeneralOptions();
        echo '<div id="message" class="updated">';
        echo '<p><strong>' . __('Settings have been saved.', 'amulang') . '</strong></p>';
        echo '</div>';
    }
    //if resetting settings
    if (isset($_POST['resetsettings'])) {
        amu_reset_default_options();
        echo '<div id="message" class="updated">';
        echo '<p><strong>' . __('Settings have been reset to default.', 'amulang') . '</strong></p>';
        echo '</div>';
    }
    addGeneralOptions();
    $infotype = 'settings';
    showPluginInfo($infotype);
    echo '</div>';
    echo '</div>';
}