Skip to:
Content
Pages
Categories
Search
Top
Bottom

Get member ID when viewing member page


  • 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)

  • Anonymous User 96400
    Inactive

    @anonymized-96400

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


    Boone Gorges
    Keymaster

    @boonebgorges

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


    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)
  • The topic ‘Get member ID when viewing member page’ is closed to new replies.
Skip to toolbar