Log in with username/password: lyceum/lyceum

root/branches/1.0/src/lyceum/system-admin/user-management.php

Revision 1270, 9.8 kB (checked in by jjb, 2 years ago)

Message for how to create a single user.

Line 
1 <?php
2 require('system-config.php');
3
4 $site_title = get_settings('site_title');
5
6 if ( isset($_POST['action']) ) {
7     check_admin_referer();
8
9     if(!('0'==$_POST['action'] || '1' == $_POST['action'] || 'delete' == $_POST['action']))
10         die;
11
12     validateToken($_POST['token'], 'user-management.php', $_POST['action']);
13
14     $whichuser = $_POST['whichuser'];
15     $action = $_POST['action'];
16
17     if ('delete' == $_POST['action']) {
18         if ($wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_locked='1' AND user_login='$whichuser'")) {
19             delete_user(mysql_real_escape_string($whichuser));
20         }
21
22     } else {
23         $wpdb->query("UPDATE `$wpdb->users` SET `user_locked`='$action' WHERE `user_login`='".mysql_real_escape_string($whichuser)."'");
24     }
25 }
26
27 $lockedaccounts = $wpdb->get_col("SELECT `user_login` FROM `$wpdb->users` WHERE `user_locked` = '1'");
28 arrayify($lockedaccounts);
29
30 // ===========================================================================
31 ?>
32 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
33     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
34
35 <head>
36     <title><?php echo $site_title ?>: Lyceum System Settings: Manage Users</title>
37
38     <link rel="stylesheet" href="<?php echo LURL ?>/wp-admin/wp-admin.css" type="text/css" />
39     <link rel="stylesheet" href="<?php echo LURL ?>/system-admin/lyceum.css" type="text/css" />
40
41     <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
42 </head>
43
44
45 <div id="PageWrapper" class="AdminUsers">
46
47 <?php require(ABSPATH . '/system-admin/lyceum-header.php'); ?>
48
49     <hr />
50
51     <!-- BEGIN: body -->
52     <div id="BodyWrapper">
53
54         <!-- BEGIN: main column -->
55         <div id="MainColumn">
56
57             <!-- BEGIN: main nav -->
58             <ul id="MainNav">
59                 <li><span><a href="settings.php">System Settings</a></span></li>
60                 <li><span><a href="blog-management.php">Blogs</a></span></li>
61                 <li class="Selected"><span><a href="user-management.php">Users</a></span></li>
62                 <li><span><a href="systemplugins.php">Plugins</a></span></li>
63                 <li><span><a href="rewriterules.php">Apache Rewrite Rules</a></span></li>
64             </ul>
65             <div class="ClearFix TabBorder"><!-- do not remove --></div>
66             <!-- END: main nav -->
67
68             <div class="wrap">
69
70                 <p>While logged in as admin you may use the regular <a href="../register">Register Form</a> to create a single user.</p>
71
72                 <!-- BEGIN: batch creation form -->
73                 <form name="batch_user_creation_form" id="batch_user_creation_form" action="createusers.php" method="post" enctype="multipart/form-data">
74                     <h2>Batch-create Users</h2>
75
76                     <p>Import a plain file of this format:</p>
77                     <blockquote>
78                         <code>username1,email1&#64;example.com;username2,email2&#64;example.com</code>
79                     </blockquote>
80
81                     <strong>NOTE: Lyceum does not go out of its way to check for a properly formated file, so please construct your file carefully.</strong>
82
83                     <fieldset>
84                         <legend>Batch User Creation</legend>
85
86                         <div class="Field">
87                             <label for="newuserlist">Data File:</label>
88                             <input type="file" name="newuserlist" id="newuserlist" />
89                         </div>
90
91                         <ul class="Inputs">
92                             <li><input type="checkbox" name="create_blog" id="create_blog" value="yes" checked="checked" /> <label for="create_blog">Create blog for each new user?</label></li>
93                         </ul>
94                    
95                         <?php echo tokeninput('createusers.php')?>
96
97                         <div class="FormAction">
98                             <input type="submit" value="Upload File" />
99                         </div>
100
101                     </fieldset>
102                 </form>
103                 <!-- END: batch creation form -->
104
105             </div>
106
107             <div class="wrap">
108
109                 <!-- BEGIN: change password -->
110                 <form name="change_user_password_form" id="change_user_password_form" action="changeuserdata.php" method="post">
111                     <h2>Change a User's Password</h2>
112
113                     <fieldset>
114                         <legend>Change User Password</legend>
115
116                         <table class="FormTable" summary="">
117                             <col width="40%" />
118                             <col width="60%" />
119
120                             <tbody>
121                                 <tr>
122                                     <th scope="row"><label for="user_login_password">Username:</label></th>
123                                     <td><input type="text" name="user_login" id="user_login_password" class="TextInput" /></td>
124                                 </tr>
125
126                                 <tr>
127                                     <th scope="row"><label for="data_value_password">New Password:</label></th>
128                                     <td><input type="text" name="data_value" id="data_value_password" class="TextInput" /></td>
129                                 </tr>
130                             </tbody>
131                         </table>
132
133                         <?php echo tokeninput('changeuserdata.php')?>
134
135                         <input type="hidden" value="user_pass" name="data_name" />
136
137                         <div class="FormAction">
138                             <input type="submit" name="submit" value="Change Password" />
139                         </div>
140                     </fieldset>
141                 </form>
142                 <!-- END: change password -->
143
144             </div>
145
146             <div class="wrap">
147
148                 <!-- BEGIN: change email -->
149                 <form name="change_user_email_form" id="change_user_email_form" action="changeuserdata.php" method="post">
150                     <h2>Change a User's Email Address</h2>
151
152                     <fieldset>
153                         <legend>Change User Email</legend>
154
155                         <table class="FormTable" summary="">
156                             <col width="40%" />
157                             <col width="60%" />
158
159                             <tbody>
160                                 <tr>
161                                     <th scope="row"><label for="user_login_email">Username:</label></th>
162                                     <td><input type="text" name="user_login" id="user_login_email" class="TextInput" /></td>
163                                 </tr>
164
165                                 <tr>
166                                     <th scope="row"><label for="data_value_email">New Email Address:</label></th>
167                                     <td><input type="text" name="data_value" id="data_value_email" class="TextInput" /></td>
168                                 </tr>
169                             </tbody>
170                         </table>
171
172                         <?php echo tokeninput('changeuserdata.php')?>
173
174                         <input type="hidden" value="user_email" name="data_name" />
175
176                         <div class="FormAction">
177                             <input type="submit" name="submit" value="Change Email Address" />
178                         </div>
179                     </fieldset>
180                 </form>
181                 <!-- END: change email -->
182
183             </div>
184
185             <div class="wrap">
186
187                 <!-- BEGIN: restrict registration form -->
188                 <form name="restrict_registration_form" id="restrict_registration_form" action="registrationlist.php" method="post" enctype="multipart/form-data">
189                     <h2>Restrict Registration</h2>
190                     <p>Restrict registration to a fixed list of email addresses.</p>
191
192                     <p>Import a plain text file of this format:</p>
193                     <blockquote>
194                         <code>email1&#64;example.com,email2&#64;example.com</code>
195                     </blockquote>
196
197                     <strong>NOTE: uploading a file will replace the existing list.</strong>
198
199                     <fieldset>
200                         <legend>Registration Restriction List</legend>
201
202                         <div class="Field">
203                             <label for="emaillist">Data File:</label>
204                             <input type="file" name="emaillist" id="emaillist" />
205                         </div>
206
207                         <?php echo tokeninput('registrationlist.php')?>
208
209                         <div class="FormAction">
210                             <input type="submit" value="Upload File" />
211                         </div>
212
213                     </fieldset>
214
215                     <ul>
216                         <li><a href="viewregistrationlist.php?token=<?php echo formtoken('viewregistrationlist.php')?>" target='_blank'>View existing list of allowed email addresses &raquo;</a></li>
217                     </ul>
218                
219                 </form>
220                 <!-- END: restrict registration form -->
221
222             </div>
223
224             <div class="wrap">
225
226                 <!-- BEGIN: lock user -->
227                 <form name="lock_user_form" id="lock_user_form" action="user-management.php" method="post">
228                     <h2>Lock an Account</h2>
229
230                     <fieldset>
231                         <legend>Lock Account</legend>
232
233                         <div class="Field">
234                             <label for="whichuser_lock">Username to lock:</label>
235                             <input type="text" name="whichuser" id="whichuser_lock" class="TextInput" />
236                         </div>
237
238                         <?php echo tokeninput('user-management.php', '1')?>
239
240                         <input type="hidden" value="1" name="action" />
241
242                         <div class="FormAction">
243                             <input type="submit" name="submit" value="Lock User" />
244                         </div>
245                     </fieldset>
246                 </form>
247                 <!-- END: lock user -->
248
249             </div>
250
251             <div class="wrap">
252
253                 <!-- BEGIN: unlock user -->
254                 <form name="unlock_user_form" id="unlock_user_form" action="user-management.php" method="post">
255                     <h2>Unlock an Account</h2>
256
257                     <fieldset>
258                         <legend>Unlock Account</legend>
259
260                         <div class="Field">
261                             <label for="whichuser_unlock">Username to unlock:</label>
262                             <input type="text" name="whichuser" id="whichuser_unlock" class="TextInput" />
263                         </div>
264
265                         <?php echo tokeninput('user-management.php', '0')?>
266
267                         <input type="hidden" value="0" name="action" />
268
269                         <div class="FormAction">
270                             <input type="submit" name="submit" value="Unlock User" />
271                         </div>
272                     </fieldset>
273                 </form>
274                 <!-- END: unlock user -->
275
276             </div>
277
278             <div class="wrap">
279
280                 <!-- BEGIN: delete user -->
281                 <form name="delete_user_form" id="delete_user_form" action="user-management.php" method="post">
282                     <h2>Delete a User from the System</h2>
283                     <p>Completely delete a user and all the comments, posts, and usermeta information for that user. Before deletion, user must be in Locked Accounts list below.</p>
284
285                     <fieldset>
286                         <legend>User Deletion</legend>
287
288                         <div class="Field">
289                             <label for="whichuser_delete">Username to delete:</label>
290                             <input type="text" name="whichuser" id="whichuser_delete" class="TextInput" />
291                         </div>
292
293                         <?php echo tokeninput('user-management.php', 'delete')?>
294
295                         <input type="hidden" value="delete" name="action" />
296
297                         <div class="FormAction">
298                             <input type="submit" name="submit" value="Delete User" />
299                         </div>
300                     </fieldset>
301                 </form>
302                 <!-- END: delete user -->
303
304             </div>
305
306             <div class="wrap">
307
308                 <!-- BEGIN: locked accounts -->
309                 <h2>Locked Accounts</h2>
310 <?php
311     if (count($lockedaccounts) > 0) {
312 ?>
313                 <ul>
314 <?php
315         foreach($lockedaccounts as $account) {
316 ?>        
317                     <li><?php echo $account ?></li>
318 <?php
319         }
320 ?>        
321                 </ul>
322 <?php
323     } else {
324 ?>        
325                 <p><em>There are no locked accounts in this system at the moment.</em></p>
326 <?php
327     }
328 ?>
329                 <!-- END: locked accounts -->
330
331             </div>
332
333         </div>
334         <!-- END: main column -->
335
336     </div>
337     <!-- END: body -->
338
339     <hr />
340
341 <?php include(ABSPATH . 'wp-admin/admin-footer.php'); ?>
342            
343 </div>
344
345
346 </body>
347
348 </html>
349
Note: See TracBrowser for help on using the browser.
Log in with username/password: lyceum/lyceum