Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // template to override member-list output
- if(!defined('WPINC')) // MUST have WordPress.
- exit("Do not access this file directly.");
- /** @var $attr array */
- /** @var $s_var string */
- /** @var $p_var string */
- /** @var $member_list_query array */
- /** @var $query WP_User_Query */
- /** @var $pagination array */
- $query = $member_list_query["query"];
- $pagination = $member_list_query["pagination"];
- if(!empty($_REQUEST[$s_var]))
- $s_val = trim(stripslashes($_REQUEST[$s_var]));
- else $s_val = ""; // No query yet.
- ?>
- <div class="ws-plugin--s2member-list-wrapper">
- <div class="ws-plugin--s2member-list-container">
- <div class="ws-plugin--s2member-list">
- <?php if($query->get_total()): ?>
- <table class="member-list">
- <thead>
- <tr>
- <th class="">Name</td>
- <th class="">IDF #</td>
- <th class="">Nationality</td>
- <th class="">Category</td>
- </tr>
- </thead>
- <tbody>
- <?php foreach($query->get_results() as $_user): ?>
- <?php if(($_fields = preg_split('/[,]+/', $attr["show_fields"], NULL, PREG_SPLIT_NO_EMPTY))): ?>
- <tr>
- <?php foreach($_fields as $_field): ?>
- <?php
- if(strpos($_field, ":") !== FALSE)
- list($_field_label, $_field) = explode(":", $_field, 2);
- else $_field_label = ucwords(preg_replace('/[^a-z0-9]+/i', " ", $_field));
- if(!($_field_label = trim($_field_label)))
- continue; // Empty.
- if(!($_field = trim($_field)))
- continue; // Empty.
- $_field_value = get_user_field($_field, $_user->ID);
- if($_field_value && is_array($_field_value))
- $_field_value = implode(", ", $_field_value);
- else $_field_value = (string)$_field_value;
- $_field_label = esc_html($_field_label);
- $_field_value = wp_rel_nofollow(make_clickable(esc_html($_field_value)));
- if(is_numeric($_field_value) && strlen($_field_value) === 10) // Convert timestamps to a date string.
- $_field_value = date_i18n(get_option("date_format")." ".get_option("time_format"), (integer)$_field_value, TRUE);
- $_field_label = apply_filters("ws_plugin__s2member_pro_sc_member_list_field_label", $_field_label, get_defined_vars());
- $_field_value = apply_filters("ws_plugin__s2member_pro_sc_member_list_field_value", $_field_value, get_defined_vars());
- ?>
- <?php if($_field_label && $_field_value): ?>
- <td>
- <span title="<?php echo esc_attr(strip_tags($_field_value)); ?>"><?php if ( $_field_value ) { echo $_field_value; } else { echo ' '; } ?></span>
- </td>
- <?php endif; ?>
- <?php endforeach; ?>
- </tr>
- <?php endif; ?>
- <?php endforeach; ?>
- </tbody>
- </table>
- <?php if(count($pagination) > 1): ?>
- <ul class="ws-plugin--s2member-list-pagination">
- <li><?php echo _x("Page:", "s2member-front", "s2member"); ?></li>
- <?php foreach($pagination as $_page): ?>
- <li><?php echo $_page["link"]; ?></li>
- <?php endforeach; ?>
- </ul>
- <?php endif; ?>
- <?php elseif($attr["enable_list_search"] && $s_val): ?>
- <p><?php echo _x('Sorry, your search returned 0 results.', "s2member-front", "s2member"); ?></p>
- <?php elseif(!$attr["enable_list_search"] && $s_val): ?>
- <p><?php echo _x('Sorry, search is not allowed here. The shortcode attribute `enable_list_search` is not enabled by the site owner.', "s2member-front", "s2member"); ?></p>
- <?php else: /* Generic message in this case. */ ?>
- <p><?php echo _x('Sorry, there are no users to list at this time.', "s2member-front", "s2member"); ?></p>
- <?php endif; ?>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement