51385ba3 by Kevin Burton

Updated the UserManager

1 parent f8bfb124
......@@ -22,25 +22,22 @@ jQuery(function() {
}
jQuery('.remove-user').colorbox({onComplete: function() {
/*
var cb = this;
var options = {
beforeSubmit: function() {}
, success: function(data) {
if (data.refresh == "true") {
document.location.href = document.location.href;
} else {
jQuery.colorbox.close();
}
, error: function(XMLHttpRequest, textStatus, errorThrown) {
document.location.href = document.location.href;
}
, data: ({ajax:"yes", action: 'update_registration'})
, data: ({ajax:"yes", action: 'remove_user'})
, dataType: 'json'
, url: '/wp-admin/admin-ajax.php'
};
jQuery('#edit-event-form').ajaxForm(options);
*/
jQuery('#remove-user-form').ajaxForm(options);
}});
jQuery('#admin-edit-user-profile').ajaxForm({
......
......@@ -389,7 +389,26 @@ function run_validation() {
class Actions {
public static function wp_ajax_remove_user() {
$remove_action = $_POST['remove_action'];
if ($remove_action=="remove_all") {
// oh boy....
@wp_delete_user( $_POST['uid'] );
} else {
update_user_meta($_POST['uid'], 'status', 'terminated');
}
$return = array(
'success' => 'true'
);
die(json_encode($return));
}
public static function wp_ajax_build_user_remove() {
$uid = $_GET['uid'];
ob_start();
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'remove_user.php');
......
......@@ -86,9 +86,9 @@ if ($filter_role) {
<th scope="col" width="250" class="manage-column">Email</th>
<th scope="col" width="200" class="manage-column">Role</th>
<th scope="col" width="100" class="manage-column">Status</th>
<!--
<th scope="col" width="100" class="manage-column">&nbsp;</th>
-->
</tr>
</thead>
<tbody>
......@@ -102,9 +102,9 @@ if ($filter_role) {
<td><?php echo $user['email']?></td>
<td><?php echo $user['role']?></td>
<td><?php echo ucwords($user['status']);?></td>
<!--
<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>
-->
</tr>
<?php endforeach; ?>
</body>
......
......@@ -34,7 +34,7 @@
<body>
<div class="title-link">Edit <?php echo $name; ?>'s CE Hours:</div>
<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>
<form method="post" action="" id="edit-cehours-form">
<input type="hidden" name="uid" value="<?php echo $uid; ?>" />
......
......@@ -34,7 +34,7 @@
<body>
<div class="title-link"><?php echo $post->post_title;?></div>
<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>
<?php
$extras = $user_event_meta['extras'];
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Remove User</title>
<style type="text/css">
html, body { margin:0px; padding:0;}
.title-link {
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;
}
form {
display: block;
margin-right:20px;
}
.dashboard-section-title { font-weight:bold; color:#3b0d32; }
</style>
</head>
<body>
<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>
<form method="post" action="" id="remove-user-form">
<input type="hidden" name="uid" value="<?php echo $uid; ?>" />
<div class="dashboard-section" style="margin-left:5px;margin-top:10px;">
<div class="dashboard-section-links"></div>
<div class="dashboard-section-content small" style="padding:10px;">
<table width="300" cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td width="20" valign="top"><input type="radio" name="remove_action" value="remove_all" id="remove_all" /></td>
<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>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td width="20" valign="top"><input type="radio" name="remove_action" value="terminate" id="terminate" checked="checked" /></td>
<td><label for="terminate">Yes, but I just want to terminate them, and remove their access to the site.</label></td>
</tr>
<tr><td valign="middle" colspan="2" class="confirm-delete" style="color:red; font-size:10px;height:25px;">&nbsp;</td></tr>
<tr>
<td colspan="2"><input type="submit" value="&nbsp;I'm sure; Proceed!&nbsp;" /></td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
<script type="text/javascript">
var $ = jQuery;
$('#remove_all').click(function() {
$('.confirm-delete').html('This action cannot be undone. Proceed with caution.');
});
$('#terminate').click(function() {
$('.confirm-delete').empty();
});
</script>
</body>
</html>
\ No newline at end of file