Updated: Comment #1

Problem/Motivation

Module is not receiving response from Instagram for @lakes' auth code and id.

Proposed resolution

Investigate why and fix.

Remaining tasks

  • Investigate why response is failing
  • Fix
  • Build error handling to prevent this from happening in the future

Original report by @lakes

Using Version 7.x 1.1I get the following error and nothing loads after using the auth key and setting up the block.
Notice: Trying to get property of non-object in instagram_block_block_view() (line 131 of C:\xxx\xxx\sheeny\sites\all\modules\instagram_block\instagram_block.module).
Warning: Invalid argument supplied for foreach() in instagram_block_block_view() (line 131 of C:\xxx\xxxx\sheeny\sites\all\modules\instagram_block\instagram_block.module).

Testing this on localhost xammp install. What could be the issue?

Comments

yanniboi’s picture

Your problem is that you are not getting any images back from instagram.

Could you post what configuration you are using? If you would rather not post your auth key on a public forum feel free to send it to me via the Contact form on my user account page: ( https://drupal.org/user/1837556/contact ).

Also when you used the configuration link to get your auth key from instagram.yanniboi.com, did you see your instagram posts in the left sidebar?

yanniboi’s picture

Issue summary: View changes

Updated the Issue Summary.

yanniboi’s picture

Ok, after checking the user id and auth key you sent me, I have had a quick look.

Good news, they work on my machine so your details are fine.

Next step is to check server configuration. First thing that pops to mind would be do you have the php curl module installed? If not, the path on #2164857: Move the Instagram request to OOP removes the php-curl dependency so you could try applying that patch and see if that helps.

Another thing you could do to help me find out what is wrong is go to the page where you are getting the error, and then looking in your site's error log and see if anything else is triggering errors (yoursite.com/admin/reports/dblog).

timtk’s picture

ok this is strange. I was testing this on localhost and live site earlier and it did not work on either. Now it's showing images on the the live site.
Might have been staring at the screen for too long. :(
Working all fine now.

I know this is a separate issue, but is there a way to include the images in a carousel to scroll through?

Once again thanks for the prompt response.

yanniboi’s picture

Status: Active » Closed (works as designed)

Sorry not at present.

auworks’s picture

Hey yanniboi,

I encountered the same error and found I wasn't getting any response from instagram API. I looked into the code and found that it was making a request to api using SSL. I added curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); and it all started working...

Cheers,
Ash

yanniboi’s picture

Thanks for posting @ashishupadhayay.

Would you mind making a patch and posting it here? That way if anyone else has a similar problem they can just use your code.

I probably won't be committing it though because in the next release I will probably move away from curl and towards http requests.

auworks’s picture

No worries. Will do...

jchin1968’s picture

#6 worked for me. Here's the patch for it.

yanniboi’s picture

Status: Closed (works as designed) » Needs review

Hey @jchin1968 thanks a lot for the patch, however unfortunately it doesn't apply any more.

instagram_block has moved on and now uses a request class and uses drupal_http_request rather than curl.
( see http://cgit.drupalcode.org/instagram_block/tree/instagram_block.lib.php line 76)

If someone could download and try the latest commit of 7.x-1.x and tell me if that fixes the problem, then I would be happy to release 7.x-1.1 for you.

Anonymous’s picture

Hi,

also having this exact same problem. Patch didn't do anything. Am using latest version and Instagram login details haven't changed from when it used to work!

The biggest issue is not the missing block, but the nasty error report being presented to everyone. That would be my #1 prio to get rid of that. I added in a

if(isset($result->data)) {...} around the for loop at line 131 to supress this. You can see how many sites have this problem by googling the error message!

thanks
Rich

carsonw’s picture

I was running into this same issue and realized that instead of entering my Instagram numeric ID at admin/config/content/instagram_block which is 1469147088, I was entering my login id (thepanhandleilc).

*smacks forehead*

breezeweb’s picture

I made another dumb mistake which caused me a lot of grief trying to track down, due to the cryptic error message.

When copying and pasting the Access Code hash from the Authorization Request, there was an extra space at the end that kept getting copied over, which I didn't notice at first. Once I fixed that it of course worked fine.

Hope that helps someone else.

brightbold’s picture

#13 solved it for me, thanks.

TomasComsolvia’s picture

#13 solved it for me also! Maybe add stripslashes() or similar so this won't happen again? ;)

yanniboi’s picture

Status: Needs review » Fixed

#2256333: Account Number/Access Token fields allow spaces which I just committed solves the space problem by trim()-ing whitespace when the access token and user id are saved.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.