Post Pay Counter

The best way to pay authors on WordPress

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

Overall stats returning null vallues

by

› Forums › Post Pay Counter PRO › Support › Overall stats returning null vallues

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 10 replies, 1 voice, and was last updated 5 years ago by Stefano.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • May 25, 2020 at 1:28 am #72694
    Michael Kim
    Guest

    Hello Stefano,

    i have been able to get some single variables for the overall stats on my project from ppc pro, but now the error appears that it returns 0.00 all the time. e.g
    PPC_general_functions::format_payment( $overall_stats[‘due_payment’] );
    always returns $0.00 to all users even if the stats have values on the general stat page..

    can you help detect what is wrong here with it?

    May 25, 2020 at 4:40 am #72698
    Stefano
    Keymaster

    Hi Michael,
    can you provide some more context? What is the code you are using? 🙂

    A nice day,
    Stefano

    May 25, 2020 at 10:38 am #72706
    Michael Kim
    Guest

    I’m building a customer admin dashboard for my users, so I would love to display to the users on the main dashboard
    1. Total post currently counting for payment / out of total number of post he published;
    2. Total current amount he made from post, visits and comments / compaare to last month (if possible)
    3. Total traffic he generated from his posts

    So i found out the above Array which seamed to be pulling out only the amount and as well also seen an array which works for the total post currently counting for payment.

    So I tried Using an echo action on php..

    Example Code <?php echo PPC_general_functions::format_payment( $overall_stats[‘due_payment’] ); ?>

    Buy It returns $0.00 on custom dashboard, and same with the total posts..
    Is there anything I’m missing in here?

    May 25, 2020 at 3:11 pm #72715
    Stefano
    Keymaster

    But do you generate $overall_stats, or where do they come from?

    An example would be

    PPC_general_functions::get_default_stats_time_range( PPC_general_functions::get_settings('general') );
    $start_time = $ppc_global_settings['stats_tstart'];
    $end_time = $ppc_global_settings['stats_tend'];
     
    $author_ID = 1;
    $stats = PPC_generate_stats::produce_stats($start_time, $end_time, array( $author_ID ));
    $raw_stats = $stats['raw_stats'];
    
    $overall_stats = PPC_generate_stats::get_overall_stats( $raw_stats );
    May 26, 2020 at 12:06 am #72725
    Michael Kim
    Guest

    This works perfectly on adding it to my validator.php, thanks alot for that..

    but it seamed analytic visits is using a different controller functions, please i will love to get for that as well…

    thanks in anticipation…

    i will be purchasing a licence for social referal today

    May 26, 2020 at 12:10 am #72727
    Michael Kim
    Guest

    i will also love to have code for last payment value

    May 27, 2020 at 9:23 am #72751
    Stefano
    Keymaster

    but it seamed analytic visits is using a different controller functions, please i will love to get for that as well…

    What do you mean with that? Visits count and payment is included in stats as a normal payment criteria.

    i will also love to have code for last payment value

    This will fetch+show the payment history for a given author ID – I think you should manage to go further from there 🙂

    $author_id = 1;
    $payment_history = PPCP_payment_history::get_author_payment_history( $author_id );
    var_dump($payment_history);
    May 29, 2020 at 2:48 am #72786
    Michael Kim
    Guest

    Hello, Thanks Alot for your response, so sorry i will giving myself a little break…

    i tried everything you sent here, but they’re some error in mosts parts, because i am turning wp_debug mode to true. so i am able to caught to error while it returns..

    1. error of this $raw_stats = $stats[‘raw_stats’];
    this line throws an error on other authors page but working fine on Admin roles with id as 1
    i am using $author_id = $current_user->ID, i am not sure if the error is from there as its not caught to be on the line from wp debug.
    please how can i make it work for all users on my user dashboard?.

    2. $author_id = $current_user->ID;
    $payment_history = PPCP_payment_history::get_author_payment_history( $author_id );
    var_dump($payment_history);

    only returns an array as the output.. help fix this..

    3. “What do you mean with that? Visits count and payment is included in stats as a normal payment criteria.”
    what i meant is, i want to echo out only the total visit stat for the month for users on the dashboard.
    i stumbled upon some codes before Eid Holidays wich i think was supposed to be for the stat only count, but i cant find it again (:

    i don’t know if you can help fix the above requirements

    May 29, 2020 at 9:21 pm #72812
    Stefano
    Keymaster

    1. error of this $raw_stats = $stats[‘raw_stats’];
    this line throws an error on other authors page but working fine on Admin roles with id as 1
    i am using $author_id = $current_user->ID

    Well I’d need to see the error to provide meaningful directions, but if it’s that $current_user is not defined, then you need to have
    global $current_user;
    before using it.

    var_dump($payment_history);
    only returns an array as the output.. help fix this..

    I know, but you should be able to see the structure it has inside, and with that to access the information you need 🙂

    what i meant is, i want to echo out only the total visit stat for the month for users on the dashboard.

    There isn’t a method to get monthly visits – you will always see the total visits for the selected time range 🙂

    June 7, 2020 at 5:56 pm #72935
    Michael Kim
    Guest

    Hey, stefeno

    1.
    i tried as you said,
    used this:
    $payment_history = PPCP_payment_history::get_author_payment_history( $author_id );
    var_dump($payment_history);
    foreach ($payment_history as $payment){
    echo $payment[‘ppc_payment’];
    }

    but nothing is happening, it displays blank..

    2.
    this was already added successfully but it still returns a critical error wgen i uncomment this line $raw_stats = $stats[‘raw_stats’];

    June 7, 2020 at 6:40 pm #72937
    Stefano
    Keymaster

    Hej,
    1. I’m not sure echo $payment[‘ppc_payment’]; inside the foreach is correct. Do a var_dump($payment) there to see what the data structure is like inside 🙂
    2. Seeing what error you get would be helpful 😉

    A nice day,
    Stefano

  • Author
    Posts
Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Overall stats returning null vallues’ 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