AJAXify user addition. Props mdawaffe. fixes #2624

git-svn-id: https://develop.svn.wordpress.org/trunk@3677 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-04-02 00:31:26 +00:00
parent e622346b7d
commit b3206083c3
9 changed files with 142 additions and 91 deletions

View File

@@ -34,14 +34,12 @@ case 'update':
check_admin_referer();
$errors = array();
if (!current_user_can('edit_users'))
$errors['head'] = __('You do not have permission to edit this user.');
$errors = new WP_Error('head', __('You do not have permission to edit this user.'));
else
$errors = edit_user($user_id);
if(count($errors) == 0) {
if( !is_wp_error( $errors ) ) {
header("Location: user-edit.php?user_id=$user_id&updated=true");
exit;
}
@@ -51,7 +49,9 @@ include ('admin-header.php');
$profileuser = new WP_User($user_id);
if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permission to edit this user.');
if (!current_user_can('edit_users'))
if ( !is_wp_error( $errors ) )
$errors = new WP_Error('head', __('You do not have permission to edit this user.'));
?>
<?php if ( isset($_GET['updated']) ) : ?>
@@ -59,11 +59,13 @@ if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permi
<p><strong><?php _e('User updated.') ?></strong></p>
</div>
<?php endif; ?>
<?php if ( count($errors) != 0 ) : ?>
<?php if ( is_wp_error( $errors ) ) : ?>
<div class="error">
<ul>
<?php
foreach($errors as $error) echo "<li>$error</li>";
foreach( $errors->get_error_codes() as $code)
foreach( $errors->get_error_messages($code) as $message )
echo "<li>$message</li>";
?>
</ul>
</div>