Patrons on my site are not getting logged in. Site is still in development, so I’ve only tried with a few tests, but it’s not going through.
I’m trying to use the theme to lock down commenting to patrons only:
<?php if( is_user_logged_in() ) :?>
<?php comment_form(); ?>
<?php else: ?>
You must be a Patreon member to comment on this post.
<?php echo do_shortcode('[patreon_login_button redirect="'.get_the_permalink().'"]'); ?>
<?php endif; ?>
The is_user_logged_in is always coming up as false, and just for fun I do
$current_user = wp_get_current_user();
which is also returning null.
When I try to login, I see user accounts getting created in the backend, but they’re just not getting logged in.
Do you have any plugins that modify login/registration behavior? Try disabling all plugins and running a test with a test patron account (a different email with the same payment info is ok) and logging into your site to check if any plugin is interfering with the process.
I had advanced access manager installed that maybe could have interfered. I disabled that but got the same error. Here’s a screenshot of my plugins list
You can try going to the functions in the WP plugin that check for a valid user, and try to catch where the rejection is occurring. Also the api return for that user may be useful.
Actually, just try to get the api return for any given user for starters.
Sorry, I’m not exactly sure how to do that.
Okay, so I did:
$papi = new Patreon_API("xxxxxxxxxxxx");
And it printed out the info for the Patreon creator.
Changed the access token to other users as pulled from the database, and I can display info on any user. So that is working.
Digging more in the database, here’s what it shows when I try to login with my patreon account:
Interesting bits: patreon_user is remaining null, but patreon_last_logged in is updated.
Api v2 requires the fields you need being specifically asked via includes. You can try doing that.
It ended up being something that my host had to open up.
So your web host was filtering specific fields in the api call?
From hosting support:
I’ve whitelisted the patreon_ cookie from our caching and the following paths patreon-flow and patreon-authorization from our caching layer and this did the trick.
For the record, the host is Flywheel should someone run into this in the future.
However note that patreon_cookie has been deprecated 3-4 years ago. It shouldnt be in the plugin. Anyone who has issues with that is using an extremely, extremely outdated version of the plugin and may experience even bigger issues.