Forums

How can I get the author username? (6 posts)

  1. atle grimseid
    Member
    Posted 2 years ago #

    Sjalabais everyone!

    I'm looking for a way to show the author username inside the post loop. I have been searhing around and nothing came up...

    What I need is the username. Not the authors full name. In my blog I get the full name when typing in "the_author()"..

    Thanks for any help. :)

  2. jdavis74
    Member
    Posted 2 years ago #

    You'll need access directly to the the database. From a MySQL command prompt, run the following query:

    select post_author from wp_posts where post_title="<Post Name>";

    Take this value and enter it into the following query:

    select user_login from wp_users where id='<value>';

    You could also use PHPMyAdmin.

    [signature moderated Please read the Forum Rules]

  3. Shane G
    Member
    Posted 2 years ago #

    Hi,

    Read this article to get more help:

    http://codex.wordpress.org/Author_Templates#Custom_Author_Information

    Thanks,

    Shane G.

  4. Justin Tadlock
    Member
    Posted 2 years ago #

    @atle grimseid

    Paste this within the loop:

    <?php the_author_meta( 'user_nicename' ); ?>

    Or:

    <?php the_author_meta( 'user_login' ); ?>

    @jdavis74

    Huh? Did you even read what was asked?

  5. Justin Tadlock
    Member
    Posted 2 years ago #

    Sorry, I just noticed you are on an old version of WordPress (you should upgrade to 2.8).

    Read what Shane G posted for older versions.

  6. atle grimseid
    Member
    Posted 2 years ago #

    Thanks :)

    Jup, I'm using 2.7.1. It's actually WPMU I'm running, witch is currently versjon 2.7.1. The reason I'm asking here in these forums is because what I need is related to one of the sub-blogs, witch would be the same as normal WordPress in my situation.

    greenshady, thanks. At least this is a good solution when I need help with this in 2.8. I'm sure it will be useful for me soon. :)

    I was looking at the solution Shane G came up with, but I'm just not quite sure if this is what I'm looking for? As far as I can see this is something I should use outeside the loop, and not inside? I will read over it again and see if there is anything I can use in there. :)

Topic Closed

This topic has been closed to new replies.

About this Topic