WordPress.org

Support

Support » Plugins and Hacks » author vs user_login

author vs user_login

  • This is Sofia again. I can get the html errors (incorrect layout and empty select list) to correct if I hardcode a user_login into the following code vs using the author name (display) ($author = get_the_author();)

    $wp_users = $wpdb->get_results("SELECT * FROM {$wpdb->users} WHERE user_login = '".$author."' ORDER BY ID");
    changed to
    $wp_users = $wpdb->get_results("SELECT * FROM {$wpdb->users} WHERE user_login = 'test1' ORDER BY ID");

    My user test1 is still unable to view comments on the site. perhaps this is an additional author vs user_login_id issue.

    http://wordpress.org/extend/plugins/whisper-comment-reloaded/

Viewing 1 replies (of 1 total)
  • This is Sofia for the last time. I fixed it!! Once I retrieved the author’s login id and used that in the sql query in place of the author’s display id, everything works just as i want it!!

    I added this
    $author_login = get_the_author_meta('user_login');

    and I replaced
    $wp_users = $wpdb->get_results("SELECT * FROM {$wpdb->users} WHERE user_login = '".<strong>$author</strong>."' ORDER BY ID");
    with
    $wp_users = $wpdb->get_results("SELECT * FROM {$wpdb->users} WHERE user_login = '".<blockquote>$author_login</blockquote>."' ORDER BY ID");

    PHP isn’t too hard 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘author vs user_login’ is closed to new replies.