Make WordPress Core


Ignore:
Timestamp:
04/02/2006 12:31:26 AM (20 years ago)
Author:
ryan
Message:

AJAXify user addition. Props mdawaffe. fixes #2624

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-edit.php

    r3615 r3677  
    3535check_admin_referer();
    3636
    37 $errors = array();
    38 
    3937if (!current_user_can('edit_users'))
    40     $errors['head'] = __('You do not have permission to edit this user.');
     38    $errors = new WP_Error('head', __('You do not have permission to edit this user.'));
    4139else
    4240    $errors = edit_user($user_id);
    4341
    44 if(count($errors) == 0) {
     42if( !is_wp_error( $errors ) ) {
    4543    header("Location: user-edit.php?user_id=$user_id&updated=true");
    4644    exit;
     
    5250$profileuser = new WP_User($user_id);
    5351
    54 if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permission to edit this user.');
     52if (!current_user_can('edit_users'))
     53    if ( !is_wp_error( $errors ) )
     54        $errors = new WP_Error('head', __('You do not have permission to edit this user.'));
    5555?>
    5656
     
    6060</div>
    6161<?php endif; ?>
    62 <?php if ( count($errors) != 0 ) : ?>
     62<?php if ( is_wp_error( $errors ) ) : ?>
    6363<div class="error">
    6464    <ul>
    6565    <?php
    66     foreach($errors as $error) echo "<li>$error</li>";
     66    foreach( $errors->get_error_codes() as $code)
     67        foreach( $errors->get_error_messages($code) as $message )
     68            echo "<li>$message</li>";
    6769    ?>
    6870    </ul>
Note: See TracChangeset for help on using the changeset viewer.