Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: MassageNetUsers
- Wordpress Template which displays all users in HTML table
- */
- ?>
- <?php get_header();
- // Get all users
- $wp_user_search = new WP_User_Query( array( /*'role' => 'subscriber', */'fields' => 'all_with_meta' ) );
- $users = $wp_user_search->get_results();
- // Custom fields stored in wp_usermeta table
- $massagenet_user_fields = array(
- 'ID',
- 'research_id',
- 'massage_therapist',
- 'massage_researcher',
- 'massage_educator',
- 'massage_student',
- 'user_type_other',
- 'user_type_other_text',
- 'title',
- 'first_name',
- 'middle_initial',
- 'last_name',
- 'suffix',
- 'city',
- 'postal_code',
- 'state_province',
- 'country',
- 'graduation_date',
- 'licensed',
- 'practice_state',
- 'license_expiration',
- 'wp-last-login',
- 'referral_source'
- );
- // Create HTML table to display all users
- function display_all_metauser_fields() {
- global $massagenet_user_fields;
- global $users;
- echo "<table border='1'><tr>";
- foreach ($massagenet_user_fields as $field) {
- echo "<th>".$field."</th>";
- }
- echo "</tr>";
- foreach ( $users as $user )
- {
- echo "<tr>";
- foreach ($massagenet_user_fields as $field) {
- echo "<td>"; echo $user->get( $field ); echo "</td>";
- }
- echo "</tr>";
- }
- echo "</table>";
- display_all_metauser_fields();
- }
- get_footer();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement