51385ba3 by Kevin Burton

Updated the UserManager

1 parent f8bfb124
...@@ -22,25 +22,22 @@ jQuery(function() { ...@@ -22,25 +22,22 @@ jQuery(function() {
22 } 22 }
23 23
24 jQuery('.remove-user').colorbox({onComplete: function() { 24 jQuery('.remove-user').colorbox({onComplete: function() {
25 /* 25
26 var cb = this; 26 var cb = this;
27 var options = { 27 var options = {
28 beforeSubmit: function() {} 28 beforeSubmit: function() {}
29 , success: function(data) { 29 , success: function(data) {
30 30 document.location.href = document.location.href;
31 if (data.refresh == "true") {
32 document.location.href = document.location.href;
33 } else {
34 jQuery.colorbox.close();
35 }
36
37 } 31 }
38 , data: ({ajax:"yes", action: 'update_registration'}) 32 , error: function(XMLHttpRequest, textStatus, errorThrown) {
33 document.location.href = document.location.href;
34 }
35 , data: ({ajax:"yes", action: 'remove_user'})
39 , dataType: 'json' 36 , dataType: 'json'
40 , url: '/wp-admin/admin-ajax.php' 37 , url: '/wp-admin/admin-ajax.php'
41 }; 38 };
42 jQuery('#edit-event-form').ajaxForm(options); 39 jQuery('#remove-user-form').ajaxForm(options);
43 */ 40
44 }}); 41 }});
45 42
46 jQuery('#admin-edit-user-profile').ajaxForm({ 43 jQuery('#admin-edit-user-profile').ajaxForm({
......
...@@ -389,7 +389,26 @@ function run_validation() { ...@@ -389,7 +389,26 @@ function run_validation() {
389 389
390 class Actions { 390 class Actions {
391 391
392 public static function wp_ajax_remove_user() {
393
394 $remove_action = $_POST['remove_action'];
395 if ($remove_action=="remove_all") {
396 // oh boy....
397 @wp_delete_user( $_POST['uid'] );
398 } else {
399 update_user_meta($_POST['uid'], 'status', 'terminated');
400 }
401
402 $return = array(
403 'success' => 'true'
404 );
405 die(json_encode($return));
406
407 }
408
392 public static function wp_ajax_build_user_remove() { 409 public static function wp_ajax_build_user_remove() {
410 $uid = $_GET['uid'];
411
393 ob_start(); 412 ob_start();
394 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'remove_user.php'); 413 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'remove_user.php');
395 414
......
...@@ -86,9 +86,9 @@ if ($filter_role) { ...@@ -86,9 +86,9 @@ if ($filter_role) {
86 <th scope="col" width="250" class="manage-column">Email</th> 86 <th scope="col" width="250" class="manage-column">Email</th>
87 <th scope="col" width="200" class="manage-column">Role</th> 87 <th scope="col" width="200" class="manage-column">Role</th>
88 <th scope="col" width="100" class="manage-column">Status</th> 88 <th scope="col" width="100" class="manage-column">Status</th>
89 <!-- 89
90 <th scope="col" width="100" class="manage-column">&nbsp;</th> 90 <th scope="col" width="100" class="manage-column">&nbsp;</th>
91 --> 91
92 </tr> 92 </tr>
93 </thead> 93 </thead>
94 <tbody> 94 <tbody>
...@@ -102,9 +102,9 @@ if ($filter_role) { ...@@ -102,9 +102,9 @@ if ($filter_role) {
102 <td><?php echo $user['email']?></td> 102 <td><?php echo $user['email']?></td>
103 <td><?php echo $user['role']?></td> 103 <td><?php echo $user['role']?></td>
104 <td><?php echo ucwords($user['status']);?></td> 104 <td><?php echo ucwords($user['status']);?></td>
105 <!-- 105
106 <td><a href="/wp-admin/admin-ajax.php?ajax=yes&action=build_user_remove&uid=<?php echo $user['uid'];?>" class="remove-user" rel="<?php echo $user['uid'];?>">Remove User</a></td> 106 <td><a href="/wp-admin/admin-ajax.php?ajax=yes&action=build_user_remove&uid=<?php echo $user['uid'];?>" class="remove-user" rel="<?php echo $user['uid'];?>">Remove User</a></td>
107 --> 107
108 </tr> 108 </tr>
109 <?php endforeach; ?> 109 <?php endforeach; ?>
110 </body> 110 </body>
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
34 34
35 <body> 35 <body>
36 36
37 <div class="title-link">Edit <?php echo $name; ?>'s CE Hours:</div> 37 <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;">Edit <?php echo $name; ?>'s CE Hours:</div>
38 38
39 <form method="post" action="" id="edit-cehours-form"> 39 <form method="post" action="" id="edit-cehours-form">
40 <input type="hidden" name="uid" value="<?php echo $uid; ?>" /> 40 <input type="hidden" name="uid" value="<?php echo $uid; ?>" />
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
34 34
35 <body> 35 <body>
36 36
37 <div class="title-link"><?php echo $post->post_title;?></div> 37 <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;"><?php echo $post->post_title;?></div>
38 38
39 <?php 39 <?php
40 $extras = $user_event_meta['extras']; 40 $extras = $user_event_meta['extras'];
......
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
8 <title>Remove User</title>
9 <style type="text/css">
10
11 html, body { margin:0px; padding:0;}
12 .title-link {
13 display:block;
14 color:#f7bd55;
15 font-size: 12px;
16 font-weight: bold;
17 text-align: left;
18 line-height: 1.75em;
19 background-color: #3b0d32;
20 border: solid 1px #FFF;
21 border-bottom: solid 1px #999;
22 cursor: default;
23 padding: 0em; padding:3px 10px 3px 10px;
24 margin: 0em;
25 }
26
27 form {
28 display: block;
29 margin-right:20px;
30 }
31
32 .dashboard-section-title { font-weight:bold; color:#3b0d32; }
33 </style>
34 </head>
35
36 <body>
37
38 <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;">Are you sure you want to remove this user?</div>
39
40 <form method="post" action="" id="remove-user-form">
41 <input type="hidden" name="uid" value="<?php echo $uid; ?>" />
42
43 <div class="dashboard-section" style="margin-left:5px;margin-top:10px;">
44 <div class="dashboard-section-links"></div>
45 <div class="dashboard-section-content small" style="padding:10px;">
46 <table width="300" cellpadding="0" cellspacing="0" border="0">
47 <tbody>
48 <tr>
49 <td width="20" valign="top"><input type="radio" name="remove_action" value="remove_all" id="remove_all" /></td>
50 <td><label for="remove_all">Yes, remove user and all related registrations, posts and comments.<br /><span style="font-size:11px; color:#999;"><em>(not recommended)</em></span></label></td>
51 </tr>
52 <tr><td colspan="2">&nbsp;</td></tr>
53 <tr>
54 <td width="20" valign="top"><input type="radio" name="remove_action" value="terminate" id="terminate" checked="checked" /></td>
55 <td><label for="terminate">Yes, but I just want to terminate them, and remove their access to the site.</label></td>
56 </tr>
57 <tr><td valign="middle" colspan="2" class="confirm-delete" style="color:red; font-size:10px;height:25px;">&nbsp;</td></tr>
58 <tr>
59 <td colspan="2"><input type="submit" value="&nbsp;I'm sure; Proceed!&nbsp;" /></td>
60 </tr>
61 </tbody>
62 </table>
63 </div>
64 </div>
65
66
67 </form>
68 <script type="text/javascript">
69 var $ = jQuery;
70 $('#remove_all').click(function() {
71 $('.confirm-delete').html('This action cannot be undone. Proceed with caution.');
72 });
73 $('#terminate').click(function() {
74 $('.confirm-delete').empty();
75 });
76 </script>
77 </body>
78 </html>
...\ No newline at end of file ...\ No newline at end of file