$show) { if ($show) { if (in_array($field, $orig_mk) or (in_array($field, $wpfields))// or //($field == 'user_registration_date') ) { // for compatibility $columns[$field] = $field; } } } return $columns; } function amr_q_orderby( $query ) { // but only in the main user list page or real query if( ! is_admin() ) return; $wpfields = amr_get_usermasterfields(); $orderby = $query->get( 'orderby'); // wp will have sanitised? if ($orderby == 'user_registration_date') // for compatibility - no longer need! delete in a version or 2 $orderby = 'user_registered'; if (!(in_array($orderby, $wpfields ))) { // assume its a meta field $query->set('meta_key',$orderby); $query->set('orderby','meta_value'); } } function amr_add_user_columns ($columns) { $colstoadd = ausers_get_option ('amr-users-show-in-wplist'); $nicenames = ausers_get_option ('amr-users-nicenames'); if (empty($colstoadd)) return $columns; //201402 avoid notices/warnings if no columns added foreach ($colstoadd as $field => $show) { if ($show) { if (!empty($nicenames[$field])) $columns[$field] = $nicenames[$field]; else $columns[$field] = $field; } } return $columns; } function amr_show_user_columns($value, $column_name, $user_id) { $colstoadd = ausers_get_option ('amr-users-show-in-wplist'); if (!empty($colstoadd[$column_name])) { $user_info = get_userdata($user_id); if (empty($value)) $value = $user_info->$column_name; if (function_exists('ausers_format_'.$column_name)) { $text = (call_user_func('ausers_format_'.$column_name, $value, $user_info)); return $text; } else { $text = amr_wp_list_format_cell ($column_name, $value, $user_info); return $text; } } else return $value; } function amr_meta_menu() { /* parent, page title, menu title, access level, file, function */ /* Note have to have different files, else wordpress runs all the functions together */ global $amain, $amr_pluginpage, $ausersadminurl, $ausersadminusersurl; if (is_network_admin() ) { $ausersadminurl = network_admin_url('admin.php'); $ausersadminusersurl = network_admin_url('users.php'); } else { $ausersadminurl = admin_url('admin.php'); $ausersadminusersurl = admin_url('users.php'); } if (empty($amain)) $amain = ausers_get_option('amr-users-main'); /* add the options page at admin level of access */ $menu_title = $page_title = __('User Lists', 'amr-users'); $parent_slug = 'amr-users'; $function = 'amrmeta_about_page'; //'amr_meta_general'; $menu_slug = 'amr-users'; $capability = 'manage_options'; $settings_page = $ausersadminurl.'?page=amr-users'; $amr_pluginpage['users'] = add_menu_page($page_title, $menu_title , $capability, $menu_slug, $function); add_action('load-'.$amr_pluginpage['users'], 'amru_on_load_page'); add_action('admin_init-'.$amr_pluginpage['users'], 'amr_load_scripts' ); $parent_slug = $menu_slug; $amr_pluginpage['general'] = add_submenu_page($parent_slug, __('User List Settings','amr-users'), __('General & about','amr-users'), 'manage_options', $menu_slug, $function); /* $amr_pluginpage['about'] = add_submenu_page($parent_slug, __('About','amr-users'), __('About','amr-users'), 'manage_options', $menu_slug, $function); $amr_pluginpage['general'] = add_submenu_page($parent_slug, __('User List Settings','amr-users'), __('General Settings','amr-users'), 'manage_options', 'ameta-admin-general.php', 'amr_meta_general_page'); */ $amr_pluginpage['exkeys'] = add_submenu_page($parent_slug, __('User List Settings','amr-users'), __('Excluded Meta Keys', 'amr-users'), 'manage_options', 'ameta-admin-meta-keys.php', 'amr_meta_keys_page'); $amr_pluginpage['fields'] = add_submenu_page($parent_slug, __('User List Settings','amr-users'), __('Fields & Nice Names', 'amr-users'), 'manage_options', 'ameta-admin-nice-names.php', 'amr_meta_nice_names_page'); $amr_pluginpage['overview'] = add_submenu_page($parent_slug, __('User List Settings','amr-users'), __('Overview & tools', 'amr-users'), 'manage_options', 'ameta-admin-overview.php', 'amr_meta_overview_page'); $amr_pluginpage['configure'] = add_submenu_page($parent_slug, __('Configure a list','amr-users'), __('Configure a list','amr-users'), 'manage_options', 'ameta-admin-configure.php', 'amrmeta_configure_page'); add_action( 'admin_head-'.$amr_pluginpage['configure'], 'ameta_admin_style' ); $amr_pluginpage['cache'] = add_submenu_page($parent_slug, __('Cache Settings','amr-users'), __('Cacheing','amr-users'), 'manage_options', 'ameta-admin-cache-settings.php', 'amrmeta_cache_settings_page'); add_action( 'admin_head-'.$amr_pluginpage['configure'], 'ameta_admin_style' ); $amr_pluginpage['add-ons'] = add_submenu_page($parent_slug, __('Add ons','amr-users'), __('Add ons','amr-users'), 'manage_options', 'user-add-ons', 'amru_add_ons_page'); if (empty($amain)) $amain = ausers_get_option('amr-users-main'); /* Need to get this early so we can do menus */ if (current_user_can('list_users') or current_user_can('edit_users')) { if (isset ($amain['names'])) { /* add a separate menu item for each list */ foreach ($amain['names'] as $i => $name) { if (isset ($amain['names'][$i])) { $page = add_submenu_page( 'users.php', // parent slug __('User lists', 'amr-users'), // title $amain['names'][$i], //menu title 'list_users', // capability 'ameta-list.php?ulist='.$i, //menu slug - must be ? why ??, priv problem if & 'amr_list_user_meta'); // function /* Using registered $page handle to hook stylesheet loading */ add_action( 'admin_print_styles-' . $page, 'add_ameta_stylesheet' ); add_action( 'admin_head-'.$page, 'ameta_admin_style' ); } } } } } 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'); } } function amrmeta_validate_text($texttype) { /* the names of lists */ global $amain; if (!empty($_POST[$texttype])) { $amain[$texttype] = wp_kses($_POST[$texttype], ameta_allowed_html()); } else $amain[$texttype] = ''; return true; } function ameta_allowed_html () { // return ('
'); } function alist_update () { return ('
'); } function alist_rebuild () { return ('
'); } function alist_rebuildreal ($i=1) { return (PHP_EOL.''.PHP_EOL.'
' .__('If you choose realtime, keep the page open after clicking the button.','amr-users').'
' .''. __('Related plugins are continually being developed in response to requests. They are packaged separately so you only add what you need.','amr-users') .'
'; echo '
[userlist] or [userlist list=n]
'; echo '