One of the most appreciated features of Post Pay Counter PRO is the shortcode, which provides the ability to display the statistics and payment details in public pages. The stats table will use your theme’s style and will be thus seamlessly integrated with the look of your site.
If you are using BuddyPress on your site, be aware that it is also possible to integrate Post Pay Counter with BuddyPress Members page with our BuddyPress addon.
This allows your users to see stats without having to access the admin section. This is useful when users are not supposed to ever access wp-admin, neither for writing posts nor for any other matter. In this way, they will not need to access wp-admin to see their earnings and to interact with the plugin.
The shortcode is [ppc]. If you use it as it is, with no parameters, the default stats page will be shown: general stats with a time range which is the default one set in Options > Misc settings > Default stats time range. This is what you would see if you just went to the wp-admin Stats page.
To get detailed stats (specific for an author), you can use the parameter author, feeding it with the user ID of which stats should be shown. For example, [ppc author=1] will show detailed stats for user ID 1. You can also use [ppc author="current"] to make the user selection dynamic: in this case, the stats for the user who opens the page will be shown.
You may want to set a time range different than the default one. For this, the parameters are tstart and tend, and accept a UNIX timestamp. An example would be [ppc author=1 tstart=1388534400 tend=1388538800]. These two, of course, can be used together with the author parameter or not, it is completely up to your needs. The parameter display_timerange can be used to hide the time range, and accepts a boolean-integered value, meaning either 1 or 0 (eg: [ppc author=1 display_timerange=0])
(Advanced: Also notice that (since PRO version 1.8.6) the arguments tstart and tend have super-flexible handling. In fact, if given an integer, it will be interpreted as a UNIX timestamp, but you can also pass it a valid PHP DateTime Format as a string, and it will be passed through strtotime and dynamically converted into timestamps. For example, [ppc tstart="first day of last month +48 hours"] will result in posts published starting from the third day of last month.)
Finally, you may want to exclude some cols from displaying, as public themes are often less wide than the admin template. For this, it is enough to list them in the parameter exclude; you can separate them with a comma. [ppc author=1 exclude="post_id, post_publication_date"] will show stats for user ID 1 excluding post id and publication date from the display table. You can mix them however you prefer.
Valid column names for general stats are: author_id, author_name, author_words, author_visits, author_images, author_comments, author_adsense_revenues, author_written_posts, author_bonus, author_facebook_shares, author_facebook_comments, author_total_payment, author_due_payment;
while for detailed stats are: post_id, post_title, post_type, post_status, post_publication_date, post_words, post_visits, post_adsense_revenues, post_images, post_comments, post_bonus, post_facebook_shares, post_facebook_comments, post_total_payment, post_due_payment.
There are a couple more parameters that can be set in the shortcode to achieve more personalized views:
- display_overall=1 – To display overall stats at the bottom of the stats table (this will display total counts and payments per counting type, number of written posts and total due payment).
- display_timerange=0 – To hide the current time range information.
- display_timerange_choices=0 – To hide the choices of different timeranges.
- time_range=”last_month” – Provides a dynamic shortcut to last month stats. Will display stats from the previous month.
time_range=”last_week” – Provides a dynamic shortcut to last week stats. Will display stats from the previous week.
time_range=”current_month” – Provides a dynamic shortcut to current month stats. Will display stats from the current month.
As a side note, bear in mind that marking posts as paid and full payment history features are not available in shortcoded stats, as they are advanced and dynamic features which rely on the admin section.
To display the current author payment history, there is another shortcode, which is [ppc_author_payment_history].
There is also a shortcode to allow users to enter the PayPal email address they would like to be paid to, which is [ppc_user_paypal_email_settings]. Other ways in which authors can enter their PayPal address are detailed in this tutorial.
- For the Referral Visits addon, there is a shortcode to display referral visits, either for the current user or for a given one. It is [ppc_referral_visits_details], and it accepts the parameter author_id. Furthermore, there is a shortcode to display the referral link box, it is [ppc_referral_link]. It accepts some parameters, the prototype being [ppc_referral_link author_id = 1, background_color = ‘#b30000’, text_color = ‘white’].