WordPress.org

Plugin Directory

Changeset 545252


Ignore:
Timestamp:
05/17/12 06:19:18 (2 years ago)
Author:
cnorris23
Message:

Code cleanup and PHPDoc clarification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • edit-author-slug/trunk/includes/admin-functions.php

    r505135 r545252  
    8888 
    8989    // We shouldn't be here if we're not updating 
    90     if ( ! $update ) 
     90    if ( !$update ) 
    9191        return; 
    9292 
    9393    // Bail if we don't have a user 
    94     if ( empty( $user ) ) 
     94    if ( empty( $user ) || !is_object( $user ) ) 
    9595        return; 
    9696 
     
    101101    check_admin_referer( 'update-user_' . $user_id ); 
    102102 
    103     // User, tell me a little about yourself. 
    104     $userdata = get_userdata( $user_id ); 
     103    // Validate the user object 
     104    $user = get_userdata( $user_id ); 
    105105 
    106106    // Setup the author slug 
     
    117117 
    118118    // Maybe update the author slug? 
    119     if ( $userdata->user_nicename != $author_slug ) { 
     119    if ( $user->user_nicename != $author_slug ) { 
    120120 
    121121        // Do we have an author slug? 
     
    132132 
    133133        // Looks like we made it, so let's update 
    134         if ( ! $updated_user_id = wp_update_user( array( 'ID' => $user_id, 'user_nicename' => $author_slug ) ) ){ 
     134        if ( !$updated_user_id = wp_update_user( array( 'ID' => $user_id, 'user_nicename' => $author_slug ) ) ){ 
    135135            $errors->add( 'ba_edit_author_slug', __( '<strong>ERROR</strong>: There was an error updating the author slug. Please try again.' ) ); 
    136136            return; 
     
    138138 
    139139        // Clear the cache for good measure 
    140         wp_cache_delete( $userdata->user_nicename, 'userslugs' ); 
     140        wp_cache_delete( $user->user_nicename, 'userslugs' ); 
    141141    } 
    142142} 
     
    261261 
    262262    if ( 'ba-eas-author-slug' == $column_name ) { 
    263         $userdata = get_userdata( $user_id ); 
    264  
    265         if ( !empty( $userdata->user_nicename ) ) 
    266             $default = esc_attr( $userdata->user_nicename ); 
     263        $user = get_userdata( $user_id ); 
     264 
     265        if ( !empty( $user->user_nicename ) ) 
     266            $default = esc_attr( $user->user_nicename ); 
    267267    } 
    268268 
Note: See TracChangeset for help on using the changeset viewer.