' .'

'.__('Custom Column Headings - mainly for multi field columns','amr-users').'

' .'

'.__('Advice: Rather use nice names to avoid confusing yourself if you configure new colmns but forget to change headings.','amr-users').'

' .' ' .'' .' '.PHP_EOL; else $headings_submit = ''; return $headings_submit; } function amr_allow_update_headings ($cols,$icols,$ulist, $sortable) { global $aopt; if (!empty($_POST['reset_headings'])) {// check for updates to headings amr_users_reset_column_headings ($ulist); amr_users_message(__('To see reset headings, rebuild the cache.', 'amr-users')); } $cols = amr_users_get_column_headings ($ulist, $cols, $icols); if (!empty($_POST['update_headings'])) {// check for updates to headings //echo '
Ulist='.$ulist; foreach ($icols as $ic => $cv) { if (isset($_POST['headings'][$ic])) { $customcols[$cv] = esc_html($_POST['headings'][$ic]); if ($customcols[$cv] === $icols[$ic]) {// if same as default, do not save !! NOT COLS unset($customcols[$cv]); } } } if (!empty($customcols)) amr_users_store_column_headings ($ulist, $customcols); } $cols = amr_users_get_column_headings ($ulist, $cols, $icols); $html = ''; foreach ($icols as $ic => $cv) { /* use the icols as our controlling array, so that we have the internal field names */ if (!($ic == 'checkbox')) { $v = ''; } else $v = $cols[$ic]; $html .= ''.$v.''; } $hhtml = ''.$html.''; /* setup the html for the table headings */ return ($hhtml); } function amrmeta_validate_listfields() { global $aopt; /* We are only coming here if there is a SAVE, now there may be blanked out fields in all areas - except must have something selected*/ if ( get_magic_quotes_gpc() ) { $_POST = array_map( 'stripslashes_deep', $_POST ); } // echo '
'.print_r($_REQUEST, true).'
';// if (isset($_POST['list'])) { if (is_array($_POST['list'])) {/* do we have selected, etc*/ foreach ($_POST['list'] as $i => $arr) { /* for each list */ if (is_array($arr)) { if (empty ($_REQUEST['config']) OR ( isset($_REQUEST['config']) and ($_REQUEST['config'] =='select' ))) { //20170125 if (!empty ($arr['selected']) and is_array($arr['selected'])) {/* do we have name, selected, etc*/ unset($aopt['list'][$i]['selected']); foreach ($arr['selected'] as $j => $v) { $v = trim($v); if ((empty($v)) or ($v == '0') ) unset ($aopt['list'][$i]['selected'][$j] ); else { if ($s = filter_var($v, FILTER_VALIDATE_FLOAT, array("options" => array("min_range"=>1, "max_range"=>999)))) { $aopt['list'][$i]['selected'][$j] = $s; } else { echo '

Error in display order for '.$j.$s.'

'; return(false); } } } // asort ($aopt['list'][$i]['selected']); /* sort at update time so we don't have to sosrt every display time */ } /* else { echo '

'.__('No fields selected for display','amr-users').'

'; return (false); } */ unset ($aopt['list'][$i]['sortby'] ); // unset all sort by's if (isset($arr['sortby']) and is_array($arr['sortby'])) { foreach ($arr['sortby'] as $j => $v) { if (a_novalue($v)) unset ($aopt['list'][$i]['sortby'][$j]); else $aopt['list'][$i]['sortby'][$j] = $v; } } /* Now check sortdir */ unset ($aopt['list'][$i]['sortdir'] ); /* unset all sort directions */ if (isset($arr['sortdir']) and is_array($arr['sortdir'])) { foreach ($arr['sortdir'] as $j => $v) { if (!(a_novalue($v))) $aopt['list'][$i]['sortdir'][$j] = $v; else $aopt['list'][$i]['sortdir'][$j] = 'SORT_ASC'; } } } /* Now check included */ if (isset($_REQUEST['config']) and ($_REQUEST['config'] ==='include_exclude' )) { unset($aopt['list'][$i]['included']); if (!empty($arr['included']) and is_array($arr['included'])) { foreach ($arr['included'] as $j => $v) { if (a_novalue($v)) unset($aopt['list'][$i]['included'][$j]); else { $aopt['list'][$i]['included'][$j] = explode (',', filter_var($v, FILTER_SANITIZE_STRING)); $aopt['list'][$i]['included'][$j] = array_map('trim', $aopt['list'][$i]['included'][$j] ); } } } unset($aopt['list'][$i]['includeonlyifblank']); if (isset($arr['includeonlyifblank']) and is_array($arr['includeonlyifblank'])) { foreach ($arr['includeonlyifblank'] as $j => $v) { $aopt['list'][$i]['includeonlyifblank'][$j] = true; } } /* Now check excluded */ unset($aopt['list'][$i]['excluded']); if (isset($arr['excluded']) and is_array($arr['excluded'])) { foreach ($arr['excluded'] as $j => $v) { if (a_novalue($v)) unset($aopt['list'][$i]['excluded'][$j]); else { $aopt['list'][$i]['excluded'][$j] = explode(',', filter_var($v, FILTER_SANITIZE_STRING)); } } } /* Now check what to do with blanks */ unset($aopt['list'][$i]['excludeifblank']); if (isset($arr['excludeifblank']) and is_array($arr['excludeifblank'])) { foreach ($arr['excludeifblank'] as $j => $v) { $aopt['list'][$i]['excludeifblank'][$j] = true; } } } if (isset($_REQUEST['config']) and ($_REQUEST['config'] ==='before_after' )) { /* Now check before*/ unset ($aopt['list'][$i]['before'] ); /* unset all */ if (isset($arr['before']) and is_array($arr['before'])) { foreach ($arr['before'] as $j => $v) { if (!(a_novalue($v))) $aopt['list'][$i]['before'][$j] = (esc_html($v)); else $aopt['list'][$i]['before'][$j] = ''; } } /* Now check after*/ unset ($aopt['list'][$i]['after'] ); /* unset all */ if (isset($arr['after']) and is_array($arr['after'])) { foreach ($arr['after'] as $j => $v) { if (!(a_novalue($v))) $aopt['list'][$i]['after'][$j] = esc_html($v); else $aopt['list'][$i]['after'][$j] = ''; } } } if (isset($_REQUEST['config']) and ($_REQUEST['config'] ==='format' )) { unset ($aopt['list'][$i]['format'] ); /* unset all */ if (isset($arr['format']) and is_array($arr['format'])) { foreach ($arr['format'] as $j => $v) { if (!empty($v)) $aopt['list'][$i]['format'][$j] = ($v); //else $aopt['list'][$i]['format'][$j] = 'none'; } } if (isset($arr['formatdate'])) { $aopt['list'][$i]['formatdate'] = sanitize_text_field($arr['formatdate']); } if (isset($arr['formattime'])) { $aopt['list'][$i]['formattime'] = sanitize_text_field($arr['formattime']); } if (isset($arr['formatdatetime'])) { $aopt['list'][$i]['formatdatetime'] = sanitize_text_field($arr['formatdatetime']); } /* Now check links*/ unset ($aopt['list'][$i]['links'] ); /* unset all */ if (isset($arr['links']) and is_array($arr['links'])) { foreach ($arr['links'] as $j => $v) { if (!empty($v)) $aopt['list'][$i]['links'][$j] = ($v); //else $aopt['list'][$i]['links'][$j] = 'none'; } } } } } ausers_update_option ('amr-users', $aopt); amr_users_message(__('Options Updated', 'amr-users')); } } return (true); } function amrmeta_datetime_formats($listindex, $config) { $df = get_option( 'date_format' ); //might be custom $tf = get_option( 'time_format' ); //might be custom $tzobj = amr_getset_timezone (); $date = new DateTime(); date_timezone_set( $date, $tzobj ); $timestamp = $date->format( 'U' ); $date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) ); if (!in_array($df,$date_formats )) //might be custom $date_formats[] = $df; $time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) ); if (!in_array($tf,$time_formats )) //might be custom $time_formats[] = $tf; foreach ($date_formats as $df) { foreach ($time_formats as $tf) { $dt_formats[] = $df.' '.$tf; } } echo '

'; _e('Define date and time formats for this list:', 'amr-users'); echo '

'; echo '

'; _e('(see also the wordpress general settings custom options)', 'amr-users'); echo '

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; _e('Date format','amr-users'); echo ''; echo '
'; _e('Time Format','amr-users'); echo ''; echo '
'; _e('Date and Time Format','amr-users'); echo ''; echo '

'; return ; } function amrmeta_format_fields( $listindex , $sel, $config) { // 20170112 global $amain, $amr_nicenames; // date format, time format, date and time format amrmeta_datetime_formats($listindex, $config); $linktypes = amr_linktypes(); if (!($ftypes = ausers_get_option('amr-users-field-types'))) $ftypes = amr_default_fieldstypes(); // nlr? get what type each field is // for options that were saved before we prevented change of some field types $fields_types_fixed = amr_fixed_fieldstypes();//2017 $fields_types = $fields_types_fixed + $ftypes; $fieldtype_formats = amr_formats_for_fieldtypes(); //get the possible formats for each field type echo PHP_EOL.'
'; echo PHP_EOL.'
'; echo '' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.''; foreach ( $sel as $i => $f ) { /* list through all the selected fields*/ echo PHP_EOL.''; $l = 'l'.$listindex.'-'.$i; echo ''; $ftype = ''; $formats = array(); if ((!empty($fields_types)) and (!empty($fields_types[$i]) )) { $ftype = $fields_types[$i]; if (!empty($ftype)) { if (!empty( $fieldtype_formats[$ftype])) { $formats = $fieldtype_formats[$ftype]; } } } // if our field has a defined type, then we can offer format options if (!empty($formats)) { echo ''; } else echo ''; if (isset($sel[$i]) and (!strpos($sel[$i],'.'))) { // if not a partial cell, then can have link type //if (isset($sel[$i]) and !strpos($sel[$i],'.')) { echo ''; } else echo ''; echo ''; } echo PHP_EOL.'
'.__('Field name','amr-users').' '.__('Format:','amr-users').'' .__(' (some formats require add-ons or custom function)') .' '.__('Link Type:','amr-users').'
'.$amr_nicenames[$i] .''; echo ''; //show sample 20171112? if (!empty($ftype)) echo ' '.'('.$ftype.')' .__('To see formats for this field, specify the fieldtype once for all lists','amr-users') .'-
'; echo PHP_EOL.'
'; echo PHP_EOL.''; return; } function amrmeta_before_after_fields( $listindex = 1, $sel, $config) { // 20170112 global $amain, $amr_nicenames; echo PHP_EOL.'
'; echo PHP_EOL.'
'; echo '' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.''; foreach ( $sel as $i => $f ) { /* list through all the selected fields*/ echo PHP_EOL.''; $l = 'l'.$listindex.'-'.$i; echo ''; echo ''; // do not use htmlentities2 here - break foreign chars echo ''; echo ''; } echo PHP_EOL.'
'.__('Field name','amr-users').' '.__('Before:','amr-users').' '.__('After:','amr-users').'
'.$amr_nicenames[$i].'
'; echo PHP_EOL.'
'; echo PHP_EOL.''; return; } function amrmeta_include_exclude_fields( $listindex = 1, $sel, $config) { // 20170112 global $amain, $amr_nicenames; echo PHP_EOL.'
'; echo PHP_EOL.'
'; echo '' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.''; foreach ( $sel as $i => $f ) { /* list through all the selected fields*/ echo PHP_EOL.''; $l = 'l'.$listindex.'-'.$i; echo ''; // echo ''; $l = 'c'.$listindex.'-'.$i; echo ''; $l = 'x'.$listindex.'-'.$i; echo ''; $l = 'b'.$listindex.'-'.$i; echo ''; echo ''; } echo PHP_EOL.'
'.__('Field name','amr-users').' ' .__('Include:','amr-users').' '.__('Include ONLY if Blank:','amr-users').' '.__('But Exclude:','amr-users').' '.__('Exclude if Blank:','amr-users').'
'.$amr_nicenames[$i].''; if (isset ($config['excludeifblank'][$i])) /* check for inconsistency and flag */ echo '*'; } else echo '/>'; echo ''; if (isset ($config['includeonlyifblank'][$i])) /* check for inconsistency and flag */ echo '*'; } else echo '/>'; echo '
'; echo PHP_EOL.'
'; echo PHP_EOL.''; return; } function amrmeta_listfields( $listindex = 1) { global $aopt; global $amain; global $amr_nicenames, $excluded_nicenames, $ausersadminurl; /* check if we have some options already in Database. - use their names, if not, use default, else overwrite .*/ if (!($checkifusingdefault = ausers_get_option ('amr-users-nicenames')) or (empty($amr_nicenames))) { //$text = __('Possible fields not configured! default list being used. Please build complete nicenames list.','amr-users'); amrmeta_check_find_fields(); exit; } echo PHP_EOL.'
'.PHP_EOL .'   '; $config = &$aopt['list'][$listindex]; $sel = &$config['selected']; if (!empty($sel)) { // any to exclude? foreach ($sel as $i=>$s) { if (!empty($excluded_nicenames[$i])) unset ($sel[$i]); } } else $sel = array(); /* sort our controlling index by the selected display order for ease of viewing */ $keyfields = array(); foreach ($amr_nicenames as $i => $n) { if ((isset ($config['selected'][$i])) or (isset ($config['sortby'][$i])) or (isset ($config['included'][$i])) or (isset ($config['includeonlyifblank'][$i])) or (isset ($config['excluded'][$i])) or (isset ($config['excludeifblank'][$i])) or (isset ($config['sortdir'][$i])) ) $keyfields[$i] = $i; } asort($amr_nicenames); if (isset ($sel)) $nicenames = auser_sortbyother($amr_nicenames, $sel); /* sort for display with the selected fields first */ else $nicenames = $amr_nicenames; if (count ($sel) > 0) { uasort ($sel,'amr_usort'); $nicenames = auser_sortbyother($nicenames, $sel); /* sort for display with the selected fields first */ } $amr_nicenames = $nicenames; //clean up variables later please // // 20170112 201703 use keyfields, not sel if (isset($_GET['config'])) { if ($_GET['config'] == 'format'){ // amrmeta_format_fields ( $listindex, $keyfields, $config); return; } if ($_GET['config'] == 'include_exclude'){ // amrmeta_include_exclude_fields ( $listindex, $keyfields, $config); return; } if ($_GET['config'] == 'before_after'){ // amrmeta_before_after_fields ( $listindex, $keyfields, $config); return; } } // echo PHP_EOL.'
'; echo PHP_EOL.'
'; echo '' .PHP_EOL.''; // display order echo PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.'' .PHP_EOL.''; foreach ( $nicenames as $i => $f ) { /* list through all the possible fields*/ echo PHP_EOL.''; $l = 'l'.$listindex.'-'.$i; if ($i === 'comment_count') $f .= '**'; echo ''; echo ''; $l = 's'.$listindex.'-'.$i; echo '' .''; } else { echo '" />'; echo '' .''; } echo ''; } echo PHP_EOL.'
'.__('Field name','amr-users').' '.__('Display order','amr-users').' '.__('Sort Order:','amr-users').' '.__('Sort Descending:','amr-users').'
'.$f .'' .'' .' -  - 
'; echo PHP_EOL.'
'; echo PHP_EOL.'
'; return; } function au_buildcache_link($text, $i,$name) { // to refresh now! global $ausersadminurl; $t = '' .$text .''; return ($t); } function au_buildcache_view_link($text, $i,$name) { // to refresh now! global $ausersadminusersurl; $t = '' .$text .''; return ($t); } function au_buildcachebackground_link() {//*** fix global $ausersadminusersurl; $t = '' .__('Build Cache for all', 'amr-users') .''; return ($t); } function amrmeta_confighelp() { // style="background-image: url(images/screen-options-right-up.gif);" $html = '

'.__('Almost all possible user fields that have data are listed in field list (nice names). If you have not yet created data for another plugin used in your main site, then there may be no related data here. Yes this is a looooong list, and if you have a sophisticated membership system, it may be even longer than others. The fields that you are working with will be sorted to the top, once you have defined their display order.', 'amr-users') .'

' .__('After a configuration change, the cached listing must be rebuilt for the view to reflect the change.', 'amr-users') .'

  1. ' .__('Enter a number in the display order column to select a field for display and to define the display order.', 'amr-users') .'
  2. ' .__('Enter a number (1-2) to define the sort order for your list', 'amr-users') .'
  3. ' .__('Use decimals to define ordered fields in same column (eg: first name, last name)', 'amr-users') .'
  4. ' .__('If a sort order should be descending, such as counts or dates, click "sort descending" for that field.', 'amr-users') .'
  5. ' .__('From the view list, you will see the data values. If you wish to include or exclude a record by a value, note the value, then enter that value in the Include or Exclude Column. Separate the values with a comma, but NO spaces.', 'amr-users') .__('Note: Exclude and Include blank override any other value selection.', 'amr-users') .'
'; return($html); } function list_configurable_lists() { global $amr_current_list, $amain,$ausersadminurl; echo PHP_EOL.'
'.PHP_EOL; amr_users_dropdown_form ($amain['names'], $amr_current_list); echo PHP_EOL; return; } function amrmeta_configure_page() { global $aopt; global $amr_nicenames; global $pluginpage; global $amain, $amr_current_list; // check if we are changing list if (!empty($_REQUEST['select'])) { if (!empty($_REQUEST['ulist']) ) $amr_current_list = (int) ($_REQUEST['ulist']); else $amr_current_list = 1; } else { if (!empty($_REQUEST['ulist']) ) $amr_current_list = (int) ($_REQUEST['ulist']); else $amr_current_list = 1; } ameta_options(); // should handle emptiness etc amr_meta_main_admin_header(__('Configure a user list','amr-users') .' : '.$amain['names'][$amr_current_list]); amr_meta_admin_headings ($plugin_page=''); // does the nonce check and formstartetc $ulist = $amr_current_list; list_configurable_lists(); // to allow selection of which to configure amr_userlist_submenu ( $amr_current_list ); $tabs['select'] = __('Fields & Sort', 'amr-users'); $tabs['format'] = __('Format', 'amr-users'); $tabs['include_exclude'] = __('Include Exclude', 'amr-users'); $tabs['before_after'] = __('Before & After', 'amr-users'); $tabs['filtering'] = __('Filtering', 'amr-users'); $tabs['navigation'] = __('Navigation', 'amr-users'); $tabs['grouping'] = __('Grouping', 'amr-users'); $configtab = 'select'; if (!empty($_GET['config'])) $configtab = sanitize_text_field($_GET['config']); amr_users_do_tabs_config ($tabs, $configtab); // else if (isset ($_REQUEST['rebuild'])) { /* can only do one list at a time in realtime */ amr_rebuild_in_realtime_with_info ($ulist); echo ausers_form_end(); return; }/* then we have a request to kick off cron */ elseif (!empty($_REQUEST['rebuildback'])) { /* */ amr_request_cache_with_feedback(); echo ausers_form_end(); return; } elseif (!empty($_REQUEST['rebuildwarning'])) { /* */ amr_rebuildwarning($ulist); echo ausers_form_end(); return; } // elseif (isset ($_REQUEST['custom_navigation'])) { elseif (isset($_GET['config']) and ($_GET['config'] == 'navigation')) { if (function_exists('amrmeta_custom_navigation_page')) { amrmeta_custom_navigation_page($ulist); echo ausers_form_end(); return; } else { echo '

'.__('Requires amr-users-plus functionality','amr-users').'

'; //20170201 return; } } //elseif (isset ($_REQUEST['grouping'])) { elseif (isset($_GET['config']) and ($_GET['config'] == 'grouping')) { if (function_exists('amr_grouping_admin_form')) { amr_grouping_admin_form($ulist); echo ausers_form_end(); return; } else { echo '

'.__('Grouping Function not active', 'amr-users').'

'; return; } } elseif (isset($_GET['config']) and ($_GET['config'] == 'filtering')) { if (!function_exists('amrmeta_filtering_page')) { echo '

'.__('Requires amr-users-plus functionality','amr-users').'

'; //20170201 return; } amrmeta_filtering_page($ulist); // doesn't exist? echo ausers_form_end(); return; } elseif (isset ($_POST['action']) and ($_POST['action'] == "save")) { // echo '
'.print_r($_POST, true).'
'; if (isset ($_POST['updateoverview']) ) { amrmeta_validate_overview(); } // elseif (isset ($_POST['update']) ) { if (!amrmeta_validate_listfields($ulist)) { amr_users_message(__('List Fields Validation failed', 'amr-users')); } // } // elseif (isset ($_POST['configure']) ) { // ulist already set above, so will just configure // } } amrmeta_listfields($ulist); echo ausers_form_end(); }