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 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 = '<input type="text" size="' . min(strlen($cols[$ic]), 80) . '" name="headings[' . $ic . ']" value="' . $cols[$ic] . '" />'; } else { $v = $cols[$ic]; } $html .= '<td>' . $v . '</td>'; } $hhtml = '<tr>' . $html . '</tr>'; /* setup the html for the table headings */ return $hhtml; }
function amr_list_headings($cols, $icols, $ulist, $sortable, $ahtm) { global $aopt; if (amr_is_plugin_active('amr-users-plus-grouping/amr-users-plus-grouping.php')) { $icols = amr_remove_grouping_field($icols); } $html = ''; $cols = amr_users_get_column_headings($ulist, $cols, $icols); // should be added to cache rather $cols = apply_filters('amr-users-headings', $cols, $icols, $ulist); //**** test this foreach ($icols as $ic => $cv) { /* use the icols as our controlling array, so that we have the internal field names */ if ($cv == 'checkbox') { $html .= $ahtm['th'] . ' class="manage-column column-cb check-column" >' . htmlspecialchars_decode($cols[$ic]) . $ahtm['thc']; } else { if (isset($cols[$ic])) { if ($sortable and !($cv == 'checkbox')) { // might not be a display field $v = amr_make_sortable($cv, htmlspecialchars_decode($cols[$ic])); } else { $v = htmlspecialchars_decode($cols[$ic]); } if ($cv === 'comment_count') { $v .= '<a title="' . __('Explanation of comment total functionality', 'amr-users') . '"href="http://wpusersplugin.com/1822/comment-totals-by-authors/">**</a>'; } //$v .= amr_indicate_sort_priority ($cv,$l['sortby'][$cv],$l['sortdir'][$cv]); $html .= $ahtm['th'] . ' class="th th' . $ic . '">' . $v . $ahtm['thc']; } } } $hhtml = $ahtm['tr'] . '>' . $html . $ahtm['trc']; /* setup the html for the table headings */ return $hhtml; }