예제 #1
0
function amr_meta_admin_headings()
{
    global $aopt;
    amr_check_for_upgrades();
    // so we only do if an upgrade and will only do if admin
    ameta_options();
    echo ausers_form_start();
    if (isset($_POST['action']) and $_POST['action'] == "save") {
        check_admin_referer('amr-meta', 'amr-meta');
    }
}
예제 #2
0
function amr_userlist($atts)
{
    global $ausers_do_network;
    global $amain, $aopt;
    remove_filter('the_content', 'wpautop');
    // doesn't work for everyone - why not ?
    $ausers_do_network = false;
    ameta_options();
    // amain will be set
    $criteria = array('show_csv', 'show_headings', 'show_search', 'show_perpage', 'show_pagination', 'show_refresh', 'show_randompage', 'shuffle', 'start_empty');
    //	if (WP_DEBUG)  {
    //		echo 'If Debug only: Attributes from shortcode: '; var_dump($atts);
    //	}
    // compatibility
    if (!empty($atts['headings'])) {
        $atts['show_headings'] = $atts['headings'];
        unset($atts['headings']);
    }
    if (isset($_REQUEST['list'])) {
        /* allow admin users to test lists from the front end, by adding list=x to the url */
        $num = (int) $_REQUEST['list'];
        if ($num > 0 and $num <= count($amain['names'])) {
            $list = $num;
        }
    } else {
        if (!empty($atts['list'])) {
            $list = (int) $atts['list'];
        } else {
            $list = 1;
        }
    }
    // else use whatever was in shortcode
    //
    $options = array();
    foreach ($criteria as $i) {
        if (isset($amain[$i][$list])) {
            $options[$i] = $amain[$i][$list];
        }
    }
    // override with shortcode
    if (!empty($atts)) {
        foreach ($atts as $i => $value) {
            $options[$i] = $atts[$i];
            if ($options[$i] === 'false') {
                // allow for the word false to be used instead of 0
                $options[$i] = false;
            }
        }
    }
    if (ausers_ok_to_show_list($list)) {
        $html = alist_one('user', $list, $options);
        //		if ($options['show_search'] or $options['show_perpage'])	{
        $html = ausers_form_start() . $html . ausers_form_end();
        //		}
        return $html;
    } else {
        return '<p><strong>' . __('Not logged in or no permission for non public user list', 'amr-users') . '</strong></p>';
    }
    //		return('<!-- '.__('Inadequate permission for non public user list','amr-users').' -->');
}
예제 #3
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;
}