Esempio n. 1
0
function amr_list_user_meta()
{
    /* Echos out the paginated version of the requested list */
    global $aopt;
    global $amain;
    global $amr_nicenames;
    global $thiscache;
    if (isset($_POST['info_update']) or amr_is_bulk_request('ym_update')) {
        amr_ym_bulk_update();
        return;
    }
    ameta_options();
    if (!isset($aopt['list'])) {
        _e("No lists Defined", 'amr-users');
        return false;
    }
    if (isset($_REQUEST['ulist'])) {
        $l = (int) $_REQUEST['ulist'];
    } else {
        if (isset($_REQUEST['page'])) {
            /*  somehow needs to be ? instead of & in wordpress admin, so we don't get as separate  */
            $param = 'ulist=';
            $l = substr(stristr($_REQUEST['page'], $param), strlen($param));
        } else {
            //echo '<br />what is happening ?';
            //var_dump($_REQUEST);
        }
    }
    if ($l < 1) {
        $l = 1;
    }
    /* just do the first list */
    //if (WP_DEBUG) echo '<br /> List requested  ='.$l;
    if (isset($_REQUEST['csv'])) {
        amr_meta_handle_export_request();
        return;
    }
    $thiscache = new adb_cache();
    // nlr?
    amr_list_user_admin_headings($l);
    // will only do if in_admin
    echo ausers_form_start();
    if (empty($_REQUEST['filtering']) and empty($_REQUEST['headings'])) {
        ausers_bulk_actions();
    }
    // will check capabilities
    echo alist_one('user', $l, array());
    /* list the user list with the explanatory headings */
    if (empty($_REQUEST['filtering']) and empty($_REQUEST['headings'])) {
        ausers_bulk_actions();
    }
    // will check capabilities
    if (function_exists('amr_ym_bulk_update_form') and amr_is_ym_in_list($l)) {
        // only show form if we have a ym field
        amr_ym_bulk_update_form();
    }
    echo ausers_form_end();
    return;
}
function amr_redirect_if_delete_requested()
{
    if (amr_is_bulk_request('delete')) {
        if (function_exists('amr_ym_bulk_update') and isset($_REQUEST['ps'])) {
            $_REQUEST['users'] = $_REQUEST['ps'];
        }
        // 'ps is required by ym
        if (isset($_REQUEST['users'])) {
            wp_redirect(add_query_arg(array('users' => $_REQUEST['users'], 'action' => 'delete'), wp_nonce_url(network_admin_url('users.php'), 'bulk-users')));
        } else {
            _e('No users selected', 'amr-users');
        }
        exit;
    }
}