WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
List of users sorted descending by date of lastest post by coauthor (2 posts)

  1. holapolitica
    Member
    Posted 1 year ago #

    Hello there,

    Its possible to list co-authors sorted descending by date of latestpost and with latest post link using coauthors_wp_list_authors().

    I found this... but it doesnt work with co-author plus http://wordpress.org/support/topic/possible-to-list-authors-by-their-last-post-date

    <ul>
    <?php
    //List of users sorted descending by date of lastest post written by user
    $uc=array();
    $blogusers = get_users_of_blog();
    if ($blogusers) {
      foreach ($blogusers as $bloguser) {
        $userpost = get_posts('showposts=1&author='.$bloguser->user_id);
        $uc[$bloguser->user_id] = '';
        if ($userpost) {
          $uc[$bloguser->user_id]=$userpost[0]->post_date;
        }
      }
      arsort($uc);
      $i = 0;
      foreach ($uc as $key => $value) {
        $user = get_userdata($key);
        $post_count = get_usernumposts($user->ID);
        if ($post_count && $i < 5) {
          $author_posts_url = get_author_posts_url($key);
          echo '<li><a href="' . $author_posts_url . '">' . $user->user_firstname . ' ' . $user->user_lastname . '</a> (' . $post_count . ') </li>';
        }
      $i++;
      }
    }
    ?>
    </ul>

    Greetings!

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Try changing this line:

    $userpost = get_posts('showposts=1&author='.$bloguser->user_id);

    To this:

    $userpost = get_posts('showposts=1&author_name='.$bloguser->user_login);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.