• Greetings to all.
    I’m trying to change the plugin KNR Author List taken from this address: http://www.nitinkatkam.com/blog/?page_id=60
    The plugin can display a ranking of authors by number of posts entered. Then it uses the plugin to create a ranking of most active users. Now I would like to promote a small contest, and I want the plugin I see only the number of articles posted by each author in the category “Contest” in order to reset the counter and start all participants at 0.

    I looked at the code and I tried to make small changes, but unfortunately I can not understand anything and I get only errors.

    I have already contacted the author of the plugin but got no answer.

    I ask you, because maybe the solution is simple and it’s me I’m losing in a glass of water.

    Thanks in advance for the whole community

Viewing 3 replies - 1 through 3 (of 3 total)
  • Don’t know about the plugin code so will give you an example of getting then number of posts by author for a given category:

    <?php
    //displays users along with count of posts each user has belonging to category 3
    $blogusers = get_users_of_blog();
    if ($blogusers) {
      foreach ($blogusers as $bloguser) {
        $user = get_userdata($bloguser->user_id);
        $userposts = get_posts('cat=3&showposts=-1&author='.$bloguser->user_id);
        $count=count($userposts);
        echo '<p>User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . ', posts in category 3: ' . $count . '</p>';
      }
    }
    ?>
    Thread Starter gene_dgk

    (@gene_dgk)

    Ok, thanks. It’s work!
    Is it possible to esclude autors without posts? And to order by n° of posts?

    Tnx

    change

    echo '<p>User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . ', posts in category 3: ' . $count . '</p>';

    to

    if ($count > 0 ) {
    echo '<p>User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . ', posts in category 3: ' . $count . '</p>';
    }

    [edit corrected if]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Mod KNR Author List’ is closed to new replies.