Skip to:
Content
Pages
Categories
Search
Top
Bottom

loop friends by last post date

  • Well, the title is pretty much self explanatory. I was wondering if there is a way to sort a BP friends loop by their last post date. The result would be a list of useres where the one on the top made the most recent post.
    Thanks a lot

Viewing 1 replies (of 1 total)
  • nevermind. i got it. Here it is:

    <?php $uc=array();
    while ( bp_members() ) : bp_the_member();
    $idautor= bp_get_member_user_id();
    $userpost = get_posts(‘showposts=1&author=’.$idautor);
    //$uc[$idautor] = ”;
    $uc[$idautor]=$userpost[0]->post_date;

    endwhile;
    arsort($uc);
    foreach ($uc as $key => $value) {
    $user = get_userdata($key);
    $post_count = get_usernumposts($user->ID);
    if ($post_count) {
    $author_posts_url = get_author_posts_url($key);
    echo ‘

  • ‘ . $user->user_firstname . ‘ ‘ . $user->user_lastname . ‘ • ‘ . $post_count . ‘ posts
  • ‘;
    }
    } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘loop friends by last post date’ is closed to new replies.
Skip to toolbar