artifex404 / grav-plugin-instagram

Instagram is a simple plugin that includes Instagram feed to your Grav website.
MIT License
16 stars 12 forks source link

Adding function {{ instagram_feed() }} to template completely dessimates the website #19

Open iwritecode opened 4 years ago

iwritecode commented 4 years ago

grav.CRITICAL: An exception has been thrown during the rendering of a template ("count(): Parameter must be an array or an object that implements Countable").

The above mentioned error gets generated when trying to use {{ instagram_feed() }} in Grav v1.7.0-rc.8 - Admin v1.10.0-rc.8 PHP V 7.1 and above.

xadammr commented 4 years ago

I get this as well.

I think it has something to do with a change in the Instagram API. Instagram recommends using the Basic Display API but I haven't been able to get it to work yet.

xadammr commented 4 years ago

It's not perfect yet but my fork xadammr/grav-plugin-instagram now works.

duceduc commented 4 years ago

@xadammr Mine stopped working today and just read that we need to use the Basic Display API. You got your feed to work by getting your app approved for Basic Display API? Was the process difficult? I am using their api for personal use and do not have an 'official app'

xadammr commented 4 years ago

@duceduc I didn't have to go through the submission / approval process because it doesn't allow anyone a sign in.

From developers.facebook.com, I created an app and added Instagram as a product:

Screen Shot 2020-07-06 at 18 04 15

Then added myself as a test user to generate a token.

Screen Shot 2020-07-06 at 18 04 33

duceduc commented 4 years ago

Hmm. That is what I did. I've created a token as like your image above, but when I input that token in the instagram plugin file, it says invalid. I noticed the token string is longer than the old one. So I thought that maybe the issue. Did you have to change any other configuration in the plugin?

Are if you input the new access token in this url, you do not receive an error? https://api.instagram.com/v1/users/self/media/recent/?access_token={NEW-ACCESS-TOKEN}

xadammr commented 4 years ago

Hi @duceduc, that API url is for the old v1 api which is now deprecated. Are there any errors in your Grav log? If you are using my fork, you will need to run php composer.phar install to download the dependencies. The only dependency is espresso-dev/instagram-basic-display-php.

MattAppleton commented 4 years ago

@xadammr — thanks for sharing your work on this — I have installed your plugin update, but still no dice.

Can I ask you for an example snippet from a template that is working? I have just dumped in {{ instagram_feed() }} into my template as I used to do (I had this working a year or so back) — but it doesn't pick up anything at all...?

Maybe I need to get the authentication right, but I wanted to check I am not doing anything dumb in the template itself first!

thanks...

xadammr commented 4 years ago

@MattAppleton -- that's all it should take. You'll need to install the dependencies using composer, though: php composer.phar install

This is the plugin folder I am using on my installation, with dependencies downloaded: instagram.zip. It should be ready to go, so long as you have a working Basic Display API key.

sebastianbaumann commented 3 years ago

Thank you very much for updating this plugin! Can you also add this to the Grav pugin repo maybe?

duceduc commented 2 years ago

@xadammr Hello. This Instagram Feed still working for you?

MattAppleton commented 2 years ago

@xadammr no, I use the grav premium plug-in now, works well...