Post Pay Counter

The best way to pay authors on WordPress

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

General

  • Pay writers per visit on WordPress
  • Shortcodes – Display stats in public pages
  • Define settings priority (user, role, category)
  • Pay per bbPress Topics and Replies
  • Caching features and stats snapshots
  • WP-CLI commands

Payment features

  • Payment features and PayPal payments
  • Setup an effective payment flow for lifetime visits
  • PayPal setup and configuration
  • Set users’ PayPal email address

Developer documentation

  • Add a custom payment criteria
  • Add a custom column to the stats table
  • Set users’ PayPal email address
  • Extract selected information from stats table
  • Handle massive Analytics data imports
  • Backup plugin data
  • Caching features and stats snapshots
  • Hide stats columns from BuddyPress Members page
  • WP-CLI commands

Analytics integration

  • Google Analytics setup and configuration
  • The future of Google Analytics integration and support for GA4
  • Matomo Analytics setup and configuration
  • Plausible Analytics setup and configuration
  • Migrate visits data away from Google Analytics
  • Share Google Adsense revenue with authors
  • Fix the “All Website Data” Analytics label issue
  • Handle massive Analytics data imports

Troubleshooting

  • Fixed a Publisher Bonus issue with complex settings setups
  • Issue with Publisher Bonus negative due payment
  • License activation failure with timeout error
  • Home
  • Docs
  • Developer documentation
  • Extract selected information from stats table

Post Pay Counter already displays payment information nicely in the stats table by default, and allows it to be included in public pages through its flexible shortcode. However, there are custom cases where you might need to extract individual bits/figures from the stats table, raw as they are.

This is easily achieved through the high-level functions exposed by the plugin. The main player here is the function PPC_generate_stats::produce_stats. The following example snippet will extract the total adsense revenue for the given $author_ID:

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'];
$total_adsense = $raw_stats[$author_ID]['total']['ppc_payment']['due_payment']['adsense_revenues'];

It will work with the default time range, but it can be changed by feeding UNIX timestamps as values of $start_time and $end_time.

Such a call of produce_stats will generate stats only for the given author, and is thus efficient. Taking away the third argument is possible, and will result in posts from any authors to be queried (and is more performant than making multiple calls with different author parameters). It is technically possible to query posts for a set of authors (in fact, notice the array-like third parameter), but there is no UI that exposes that feature in the stats page.

Adding

var_dump($raw_stats[$author_ID]['total']);

will result in exposing the data structure and show all possible choices of payment criteria and information that can be extracted.

  • Was this Helpful ?
  • Yes   No
stats
What are your Feelings
Updated on April 11, 2022
Set users’ PayPal email addressHandle massive Analytics data imports

Copyright © 2025 · Centric Theme on Genesis Framework · WordPress · Log in