Come on man. I told you on the support ticket that I wiped the users meta cache straight in mysql and disabled all caching. I also told you what code block I commented out for it to work.
But primarily, I am just asking for a better message so Patrons aren’t authorizing through Patreon and then seeing the exact same page with no clue whatsoever why they can’t see the content.
I posted the following metadata examples:
This particular patreon has resubscribed, and as far as I can tell from this output, there was an issue with the payment. But the status message doesn’t give any hint about that, so that leaves our members very confused.
[campaign_lifetime_support_cents] => 2805
[currently_entitled_amount_cents] => 0
[last_charge_date] => 2021-12-03T15:34:54.000+00:00
[last_charge_status] => Declined
[lifetime_support_cents] => 2805
[patron_status] => declined_patron
[pledge_cadence] => 1
[pledge_relationship_start] => 2021-10-05T19:02:49.800+00:00
[amount_cents] => 0
[created_at] => 2021-10-05T19:02:49.800+00:00
[declined_since] => 2021-12-03T15:34:54.000+00:00
This patreon has paid status on his profile, but we get this [from the api]:
[campaign_lifetime_support_cents] => 13499
[currently_entitled_amount_cents] => 1400
[last_charge_date] => 2021-12-01T21:55:20.000+00:00
[last_charge_status] => Pending
[lifetime_support_cents] => 13499
[patron_status] => active_patron
[pledge_cadence] => 1
[pledge_relationship_start] => 2021-09-01T06:09:16.102+00:00
[amount_cents] => 1400
[created_at] => 2021-09-01T06:09:16.102+00:00
[declined_since] => 2021-12-01T21:55:20.000+00:00
[WIth both of these examples.] user goes to the website, clicks the Login with Patreon button, and gets redirected - only to be shown the exact same page “… you must be a member…”.
As for not checking last_charge_status
, you might want to re-read your code:
public function fetch_user() {
...
if ( $api_return['included'][0]['attributes']['last_charge_status'] != 'Paid' ) {
$api_return['included'][0]['attributes']['declined_since'] = $api_return['included'][0]['attributes']['last_charge_date'];
}
public static function getUserPatronage( $user = false ) {
...
if ( isset( $pledge['attributes']['declined_since']) && !is_null( $pledge['attributes']['declined_since'] ) ) {
do_action('ptrn/declined_since', $pledge, $pledge['attributes']['declined_since']);
return false;
}
public static function isPatron( $user = false ) {
...
$user_patronage = self::getUserPatronage();
if( is_numeric( $user_patronage ) && $user_patronage > 0 ) {
return self::$current_user_is_patron = true;
}
else {
return self::$current_user_is_patron = false;
}
If you want to reproduce it yourself, just take the serialized data i sent on the ticket and insert in mysql and override some code so that it doesn’t update that userid through the API - I’m sure you could find a way.
And again - all I’m asking is for a more descriptive message after the patron is logged into wordpress. I fully understand the complexities of trying to determine if the patron has actually paid for the current period. On that point specifically, I have found through debugging with half a dozen users that they all had either a pending charge, a declined charge, or some other issue with the payment method, which leads me to believe that the Patron API is actually more correct than their website. But I can’t be 100% sure about that, hence the request for a better message when encountering these states.