Post Pay Counter

The best way to pay authors on WordPress

  • Features
    • PRO version
  • Cart
    • Addons
  • Documentation
  • Support

Top 5 Earners

by

› Forums › Post Pay Counter PRO › Support › Top 5 Earners

We are based in Europe with a GMT+1/GMT+2 time zone - support replies may be delayed due to time zone differences with your country.

  • This topic has 3 replies, 2 voices, and was last updated 7 years, 5 months ago by Stefano.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • January 12, 2018 at 7:36 pm #59916
    Snehil
    Guest

    Hi,

    I want to feature top 5 earners of the week in my blog sidebar. Can you please suggest the best way to do that using ppc metadata?

    Thanks,
    Snehil

    January 13, 2018 at 9:17 am #59919
    Stefano
    Keymaster

    Hi Snehil,
    there are no metadata on stats as stats they are generated on the fly and then cached for a day, but nothing permanent is stored.

    However, you can use the high-level method

    PPC_generate_stats::produce_stats( $time_start, $time_end, $author, $format )

    to generate stats for a given time range and authors (in your case, set $authors to NULL to get stats for all authors). $format is a boolean that affects the output: if it’s true, you will also get a ready-to-be-output version of the data.

    To get the top 5 earners, you will still have to sort the data on your own. I’d encourage you to make the call to the function, printing the result (it’s going to be a big multi-dimensional array) and then reporting back any issues/doubts you may still have ๐Ÿ™‚

    The function you’d be calling is located in post-pay-counter/classes/ppc_generate_stats_class.php, and it (and the methods it invokes) do have some decent inline documentation ๐Ÿ™‚

    Have a nice day,
    Stefano

    January 13, 2018 at 10:53 am #59922
    Snehil
    Guest

    Thanks for the detailed info.

    I am thinking to create a shortcode output the top earners. To start with I added the below snippet in my functions.php file.

    function top_earners() {
    PPC_generate_stats::produce_stats( $time_start, $time_end, null, true )
    }
    add_shortcode(‘top_earners’, ‘top_earners’);

    Can you please let me the the format in which I should pass values to $time_start and $time_end variables. Sorry for being naive, but I do not have enough PHP coding experience.

    January 13, 2018 at 2:18 pm #59928
    Stefano
    Keymaster

    There are a bunch of shortcode functions you get inspiration from in post-pay-counter-pro/classes/ppcp_shortcode_class.php ๐Ÿ™‚

    $time_start and $time_end should be UNIX timestamps.

    Have a nice day,
    Stefano

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Top 5 Earners’ is closed to new replies.

Your cart

Number of items in cart: 0

  • Your cart is empty.
  • Total: €0.00
  • Checkout

What are you looking for?

BEFORE POSTING

Before posting, please please please do have a look at our Documentation section. Your problem may be addressed there, allowing you to solve it without help from us :)

Copyright © 2025 ยท Centric Theme on Genesis Framework ยท WordPress ยท Log in