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

**URL:** <https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838>\
**Category:** Wordpress Plugin\
**Created:** [July 6, 2018, 1:14am UTC](https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838 "2018-07-06T01:14:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonporath](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/jasonporath/32/421_2.png) [@jasonporath](https://www.patreondevelopers.com/u/jasonporath)\
**Post date:** [July 6, 2018, 1:14am UTC](https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838/1 "2018-07-06T01:14:28Z")

</div>

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;
    $ptrn_pledge=$Patreon_Wordpress->getUserPatronage();

```

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

---

<div class="post-metadata">

**Author:** ![jasonporath](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/jasonporath/32/421_2.png) [@jasonporath](https://www.patreondevelopers.com/u/jasonporath)\
**Post date:** [July 6, 2018, 1:18am UTC](https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838/2 "2018-07-06T01:18:24Z")

</div>

Oh, and my website: [https://www.rejectedprincesses.com/](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…?)

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [July 6, 2018, 3:50pm UTC](https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838/3 "2018-07-06T15:50:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jasonporath](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/jasonporath/32/421_2.png) [@jasonporath](https://www.patreondevelopers.com/u/jasonporath)\
**Post date:** [July 6, 2018, 4:17pm UTC](https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838/4 "2018-07-06T16:17:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [July 6, 2018, 7:47pm UTC](https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838/5 "2018-07-06T19:47:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [July 7, 2018, 11:58pm UTC](https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838/6 "2018-07-07T23:58:09Z")

</div>

Similarly:

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:

> **[patreon-wordpress.zip](https://www.dropbox.com/s/pi76jyf2ciqt4wb/patreon-wordpress.zip?dl=0)**
>
> Shared with Dropbox

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [July 12, 2018, 5:17pm UTC](https://www.patreondevelopers.com/t/unspecified-index-data-error-from-1-1-2-plugin-but-only-on-mobile/838/7 "2018-07-12T17:17:40Z")

</div>

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.
