"Unspecified index: data" error from 1.1.2 plugin - but only on mobile?

Hey y’all - I’ve been getting this error (but only on mobile) on my site that’s using the 1.1.2 version of Patreon WordPress:

Notice: Undefined index: data in /path/to/wp-content/plugins/patreon-connect/classes/patreon_wordpress.php on line 180

The line in question is in the checkv2APIAccess() function:
if($api_response[‘data’][0][‘type’]==‘campaign’) {

What I am guessing is happening is that I am checking to see if someone is logged in or not, and I may not be using the most current sanctioned method to do so (I’ve been using this plugin for some time across its various incarnations). I believe how I’m doing it (and I don’t have time to chase this down right now to verify) is this bit of code:

    global $Patreon_Wordpress;

If it returns zero, I mark them as not a Patreon backer. Is this not the way to do it?

Oh, and my website: https://www.rejectedprincesses.com/

(I also just switched over to HTTPS - I know, I’m super late to that - so that may be a factor…?)

That function there is for checking if API v2 is available. The notice ends up happening because API v2 doesnt return a result, since its not available. You can safely ignore that notice.

The rest of your post about checking a patron pledge is a bit unclear. If you can elaborate it more that would be good.

If you switched to https, you need to force all urls in your WP side to become served from https, and change the redirect uri setting at your client details to the https:// version. Or you will have issues with users who come from http:// urls and try to log in and end up getting rejected.

It’s good I can ignore that notice - but could the plugin be modified to prevent it from happening in the first place?The only other option I’m aware of is for me to turn all error output on my site, and I’d prefer not to do that (makes it harder for me to spot problems when they arise).

I’ve modified the backend to work with HTTPS redirects, that’s doing fine.

There are a small number of such notice-inducing situations for edge cases in current plugin code. They will be handled as time goes by. Currently our priority is on adding major features and making sure the plugin works with majority of common setups.

Apart from that, PHP notices and warnings are not errors and they should not be on on a production server in any case. For a staging server, setting E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING (all errors except deprecated, notice and warnings) should give you enough insight to any potential issues in your plugin setup. If you are logging instead of displaying, you can turn as many of the notice/warning options as your log file and system can handle.

We appreciate getting notified of such situations definitely, and it will help us better the plugin. But to launch and get going, you should just skip by any such minor issue and just check if the system works properly with error reporting turned off (or at least notice, warn and deprecated off) - simply because such notices will go out before headers are sent, and this will break a lot of redirects happen inside WordPress.


Please delete the existing Patreon WordPress on your site (deactivate first), then upload and activate the below package with oauth error reporting and see if it sheds any light on this issue by showing an error:

As earlier threads, updating:

There were changes made at CloudFlare to address this issue just today.

Please try to reproduce the issue and let us know if it occurs, or if you are not able to reproduce it at all. Any input is appreciated.