-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdirectory.php
More file actions
131 lines (109 loc) · 4.26 KB
/
directory.php
File metadata and controls
131 lines (109 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
require_once( "include/page_elements.php" );
require_once( "include/directory.php" );
/* Short and sweet */
define('WP_USE_THEMES', false);
require_once('wp-backend/wp-blog-header.php');
http_response_code(200); // override wp
// must be logged in
if ( ! is_user_logged_in() )
{
header('Location: /login.php?r=%2fdirectory.php');
die();
}
// Comparison function
function user_cmp($a, $b) {
$a1 = $a->last_name;
$b1 = $b->last_name;
$cc = strcoll($a1, $b1);
if ($cc != 0)
return $cc;
$a1 = $a->first_name;
$b1 = $b->first_name;
return strcoll($a1, $b1);
}
$userlist = get_users();
// Sort it.
setlocale(LC_ALL, 'en_US.UTF-8');
uasort( $userlist, 'user_cmp' );
if ( current_user_can( 'edit_posts' ) && isset( $_POST[ 'download_users' ] ) ) {
download_userlist( $userlist );
die();
}
?>
<!DOCTYPE html>
<html>
<?php page_head( "LigerBots Directory" ); ?>
<body>
<div id="header-ghost" ></div>
<div class="container-fluid no-side-padding">
<div class="col-xs-12 no-side-padding">
<?php
output_header();
output_navbar();
?>
<div class="row page-body">
<div class="col-md-12 col-md-offset-0 col-sm-10 col-sm-offset-1 col-xs-12">
<div class="row top-spacer"> </div>
<div class="row bottom-margin row-margins">
<div class="col-xs-12">
<center>
<div class="notindex-title">LIGERBOTS DIRECTORY</div>
<br/><br/>
The information on this page is confidential - It is only available to registered and approved users.
<br/>
</center>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Phone Number</th>
<th>Email</th>
<th>Address</th>
<th>School</th>
<th>Role</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $userlist as $user )
{
// Don't list users who have not been approved
if ( ! $user->get( 'wp-approve-user' ) ) continue;
if ( $user->user_login == 'attendance-pi' ) continue;
echo '<tr>';
echo ' <td>' . esc_html( $user->first_name ) .'</td>';
echo ' <td>' . esc_html( $user->last_name ) .'</td>';
echo ' <td>' . esc_html( $user->get( 'phone' ) ) . '</td>';
echo ' <td>' . esc_html( $user->user_email ) .'</td>';
$addr = join( ', ', array( $user->get( 'address' ), $user->get( 'city' ),
join( ' ', array( $user->get( 'state' ), $user->get( 'postalcode' ) ) ) ) );
if ( $addr == ', , ' ) $addr = '';
echo ' <td>' . esc_html( $addr ) . '</td>';
$school = $user->get( 'school' );
if ( strtoupper($school) == 'NONE' ) $school = '';
echo ' <td>' . esc_html( $school ) . '</td>';
echo ' <td>' . esc_html( join( ', ', $user->get( 'team_role' ) ) ) . '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
<?php
if ( current_user_can( 'edit_posts' ) ) {
echo '<form class="form-inline" action="' . $_SERVER['PHP_SELF'] . '" method="post">';
echo '<button type="submit" name="download_users" class="btn btn-default">Download Userlist</button>';
echo "</form>\n";
}
?>
</div>
</div>
<?php output_footer(); ?>
</div>
</div>
</div>
</div>
<?php page_foot(); ?>
</body>
</html>