Support » Plugin: Post Pay Counter » Partial Payment

  • Is it possible to partially pay a user?

    For example, if we owe you $1k through May 1, pay you $1k on May 15, we should be able to mark $1k as paid through Post Pay Counter even if by that time $1.5k has been accrued. This should result in a balance owed of $500. Right now I think we can only check a box to mark it all as paid.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Stefano

    (@ste_95)

    Hi Danny,
    you can pay individual posts within a user, if that can help. You can open one author and pay the posts that sum up to $1k, while saving the newer ones for later.

    A nice day,
    Stefano

    Thread Starter Danny Cooper

    (@dannycooper)

    Thanks Stefano @ste_95, I have another question:

    My client uses your Pro plugin, the dataset used to build the Post Pay Counter → Stats page is in excess of 400mb, so the server mostly times out before the page is rendered. It’s possible to access the stats instead using the CLI command wp ppc stats --cache-full and the URL it outputs.

    However, even when creating the full cache the Post Pay Counter → Stats link doesn’t appear to utilize that cache and seems to try to build the page from scratch. Is there a resolution?

    Plugin Author Stefano

    (@ste_95)

    Uhm, that’s odd. Were you in some way able to debug if the cached snapshot is not used at all, or if it is itself too big to be used?

    Thread Starter Danny Cooper

    (@dannycooper)

    Apologies if I am misunderstanding how your code works, but I don’t see how the cache can be used when the wp-admin/admin.php?page=ppc-stats link in the navigation is used.

    The cache system looks for an exact match on the start/end times:

    //If there are full-cache stats available, use them. These can be generated only through WP-CLI
    		if( ! is_array( $author ) AND ! $perm->can_see_others_general_stats() )
    			$cache_slug = 'ppc_stats-tstart_'.$time_start.'-tend_'.$time_end.'-author_'.$current_user->ID.'-as-user'.$current_user->ID;
    		else if( is_array( $author ) )
    			$cache_slug = 'ppc_stats-tstart_'.$time_start.'-tend_'.$time_end.'-author_'.$author[0].'-as-user_'.$author[0];
    		else
    			$cache_slug = 'ppc_stats-tstart_'.$time_start.'-tend_'.$time_end.'-as-user_'.$current_user->ID;<code></code>
    
    If stats_tend is not set in the URL then they default to the first_available_post_time and last_available_post_time, for example:
    
    <code></code>ppc_stats-tstart_1614125607-tend_1657257966-as-user_1<code></code>

    But the CLI command appears to generate a different tend value each time:

    
    wp ppc stats --time-start=2022-07-01 --cache-full
    Now loading stats...
    Time range: 2022-07-01 - 2022-07-08
    As user: example (ID: 1)
    
    This may take a while... 
    
    Cached stats with slug ppc_stats-tstart_1656633600-tend_1657258938-as-user_1, size 7769 KB, outcome 1
    Success: Stats generated in 1 seconds. 
    Visit them at: https://example.co/wp-admin/admin.php?page=ppc-stats&tstart=1656633600&tend=1657258938&cache-full&author=
    baseos | sgvps.net:~/www/example.co/public_html$ wp ppc stats --time-start=2022-07-01 --cache-full
    Now loading stats...
    Time range: 2022-07-01 - 2022-07-08
    As user: example (ID: 1)
    
    This may take a while... 
    
    Cached stats with slug ppc_stats-tstart_1656633600-tend_1657258946-as-user_1, size 7769 KB, outcome 1
    Success: Stats generated in 0 seconds. 
    Visit them at: https://example.co/wp-admin/admin.php?page=ppc-stats&tstart=1656633600&tend=1657258946&cache-full&author=
    baseos | sgvps.net:~/www/example.co/public_html$

    The tstart value does appear to be correct (match first_available_post) when no parameters are set:

    $ wp ppc stats --cache-full
    Now loading stats...
    Time range: 2021-02-24 - 2022-07-08
    As user: example (ID: 1)
    
    This may take a while... 
    
    Cached stats with slug ppc_stats-tstart_1614125607-tend_1657258495-as-user_1, size 426801 KB, outcome 1
    Success: Stats generated in 156 seconds. 
    Visit them at: https://example.co/wp-admin/admin.php?page=ppc-stats&tstart=1614125607&tend=1657258495&cache-full&author=

    For reference, here is the PPC global settings:

      ["first_available_post_time"]=>
      int(1614125607)
      ["last_available_post_time"]=>
      int(1657257966)
      ["stats_tstart"]=>
      string(10) "1614125607"
      ["stats_tend"]=>
      string(10) "1657257966"
    Plugin Author Stefano

    (@ste_95)

    I haven’t tested this in a while so I’d have to check it again myself, but just to clarify: which is the issue for you?
    a) the link you get after running wp ppc stats does not load cached stats
    b) you would like cached stats to be loaded by visiting the stats page alone, not by following the link shown from the WP CLI output.

    Thread Starter Danny Cooper

    (@dannycooper)

    Yes, my issue is with b.

    A) works as expected, but it isn’t really a solution that can be utilised by non technical users.

    Plugin Author Stefano

    (@ste_95)

    I see, I’ll have a look and see if it can be improved. Just now I honestly don’t remember why I did it that way…

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.