Skip to:
Content
Pages
Categories
Search
Top
Bottom

Get member ID when viewing member page

  • Avatar of driz
    driz
    Participant

    @driz

    How can I get the member ID of the user on a member profile so that I can show a list of posts by that user. So for example: domain.com/members/cameron/

    and then in the page: “ how do I get that author ID? THANKS

Viewing 6 replies - 1 through 6 (of 6 total)
  • Avatar of Travel-Junkie
    Boris
    Participant

    @travel-junkie

    That would be `$bp->displayed_user->id`. Don’t forget to declare $bp as a global before (`global $bp;`)

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Try `query_posts( ‘author=’ . $bp->displayed_user->id )`

    Avatar of driz
    driz
    Participant

    @driz

    Thanks guys

    Thanks guys! Here’s my complete code that seems to be working great. I’ve added this to mythemefolder/members/single/member-header.php

    <?php global $bp;
    query_posts( ‘author=’ . $bp->displayed_user->id );
    if (have_posts()) : ?>

    Posts:

    • <a href="”>


    <?php endif;
    wp_reset_query();?>

    Oops, sorry about that. I’m not seeing instructions anywhere on how to post code, and it won’t let me edit or delete that last post. :S

    hi, this could be useful for me aswell, but how can i specify the number of posts to show under the profile. for example if a member posted 60 posts its going to show 60 posts, but how can i change it to show may be 8 posts.

    regards

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.