209c88fc by Kevin Burton

updates to overview

1 parent 3bf9453c
......@@ -451,6 +451,10 @@ class AccountValidation extends Common\Validation {
}
}
public function membership_valid_until($val) {
update_user_meta($_POST['uid'], 'membership_valid_until',$val);
}
}
class CreateValidation extends Common\Validation {
......
......@@ -14,7 +14,7 @@ use Tz\WordPress\Tools\Notifications;
use Exception, StdClass;
use WP_User, WP_Roles;
$uid = $user->ID;
$uid = $_GET['uid'];
$account = new User\Account($uid);
$pp = get_user_meta($uid, 'profile_preference', true).'_';
......@@ -49,6 +49,7 @@ use WP_User, WP_Roles;
?>
<div style="padding:10px 10px 0px 10px; min-width:760px;">
<form method="post" id="overview_form">
<h2 style="margin-bottom:10px;padding-bottom:0px;">Overview of Users' Account...</h2>
<div style="float:left; width:300px;margin-right:50px;">
......@@ -95,39 +96,8 @@ use WP_User, WP_Roles;
</tbody>
</table>
</div>
<div style="float:left; width:360px; border-left: 1px solid #ccc;">
<div style="margin-left:20px; margin-bottom:20px;">
<!-- coming soon...
<h3 style="margin-bottom:5px; padding-bottom:0px;">Account Balance:</h3>
<div style="color:red; font-size:18px;">-$130.00</div>
-->
<form method="post" id="overview_form">
<input type="hidden" name="uid" value="<?php echo $uid; ?>" />
<input type="hidden" name="section" value="account" />
<h3 style="margin-bottom:5px; padding-bottom:0px;">Account Status:</h3>
<select name="status">
<option value="active" <?php echo ($status=="active") ? "selected" : ""; ?>>Active</option>
<option value="suspended" <?php echo ($status=="suspended") ? "selected" : ""; ?>>Suspended</option>
<option value="terminated" <?php echo ($status=="terminated") ? "selected" : ""; ?>>Terminated</option>
</select>
<div style="clear:both;"></div>
<?php if($role!="administrator"):?>
<h3 style="margin-bottom:5px; padding-bottom:0px;">Account Type:</h3>
<select name="user_role" id="user_role">
<?php foreach($roles as $roled=>$name):?>
<option value="<?php echo $roled;?>" <?php echo ($roled==$role) ? "selected" : "";?>><?php echo $name;?></option>
<?php endforeach;?>
</select>
<div style="clear:both;"></div>
<?php endif; ?>
<h3 style="margin-bottom:5px; padding-bottom:0px;">Change User Password:</h3>
<h3 style="margin-bottom:5px; padding-bottom:0px;">Change User Password:</h3>
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
......@@ -180,6 +150,84 @@ use WP_User, WP_Roles;
<div style="clear:both;"></div>
</div>
</div>
<div style="float:left; width:360px; border-left: 1px solid #ccc;">
<div style="margin-left:20px; margin-bottom:20px;">
<!-- coming soon...
<h3 style="margin-bottom:5px; padding-bottom:0px;">Account Balance:</h3>
<div style="color:red; font-size:18px;">-$130.00</div>
-->
<input type="hidden" name="uid" value="<?php echo $uid; ?>" />
<input type="hidden" name="section" value="account" />
<h3 style="margin-bottom:5px; padding-bottom:0px;">Account:</h3>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody>
<tr>
<td width="100">Status:</td>
<td>
<select name="status" style="width:150px;">
<option value="active" <?php echo ($status=="active") ? "selected" : ""; ?>>Active</option>
<option value="suspended" <?php echo ($status=="suspended") ? "selected" : ""; ?>>Suspended</option>
<option value="terminated" <?php echo ($status=="terminated") ? "selected" : ""; ?>>Terminated</option>
</select>
</td>
</tr>
<?php if($role!="administrator"):?>
<tr>
<td>Type:</td>
<td>
<select name="user_role" id="user_role" style="width:150px;">
<?php foreach($roles as $roled=>$name):?>
<option value="<?php echo $roled;?>" <?php echo ($roled==$role) ? "selected" : "";?>><?php echo $name;?></option>
<?php endforeach;?>
</select>
</td>
</tr>
<?php endif; ?>
<?php
$mau = get_user_meta($_GET['uid'], 'membership_valid_until', true);
if ( !empty($mau) ) {
$current_mau = $mau;
} else {
$current_mau = "";
}
?>
<tr>
<td>Active Until</td>
<td>
<select name="membership_valid_until" id="membership_valid_until" style="width:150px;">
<option value="" <?php echo ($current_mau=="") ? "selected" : ""; ?>>Select ...</option>
<?php if ( !empty($current_mau) ): ?>
<option value="<?php echo $current_mau;?>" selected><?php echo $current_mau;?></option>
<?php endif; ?>
<optgroup label="Change to:">
<?php
$max_avail_mau = ((int) date("Y") + 3);
for($mi = (int) date("Y"); $mi <= $max_avail_mau;$mi++) {
echo '<option value="'.$mi.'">'.$mi.'</option>';
}
?>
</optgroup>
</select>
</td>
</tr>
</tbody>
</table>
<div style="clear:both;"></div>
<div>
<h3>Groups:</h3>
<ul>
......@@ -204,13 +252,14 @@ use WP_User, WP_Roles;
<br />
<input type="submit" value="Update Account" /><span class="update-placeholder"></span>
</form>
</div>
<div style="clear:both;"></div>
</div>
<div style="clear:both;"></div>
</form>
</div>
<script src="<?php echo Tools\url('../UserManager.js', __FILE__);?>" type="text/javascript"></script>
......