WordPress.org

Plugin Directory

Changeset 563834


Ignore:
Timestamp:
06/26/12 01:27:05 (22 months ago)
Author:
cnorris23
Message:

Use the WP_User API rather than direct query for duplicate nicename check

File:
1 edited

Legend:

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

    r563833 r563834  
    165165 
    166166        // Does this author slug already exist? 
    167         if ( $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s", $author_slug ) ) ) { 
     167        if ( (int) get_user_by( 'slug', $author_slug )->ID !== $user_id ) { 
    168168            $errors->add( 'ba_edit_author_slug', sprintf( __( '<strong>ERROR</strong>: The author slug, %1$s, already exists. Please try something different.' ), '<strong><em>' . esc_attr( $author_slug ) . '</em></strong>' ) ); 
    169169            return; 
Note: See TracChangeset for help on using the changeset viewer.