justb3a

Module: Instagram Feed

Recommended Posts

I kept running into the issue of self-invalidating access tokens and wanted the site's content editors to be able to handle the generation of new access tokens themselves. The module, however, limits those functions to superusers.

Could you change the module to check for the module-admin permission? It's ProcessWire's internal permission to check who can edit module configurations. It's deactivated by default and has to be created and assigned manually, so there's no additional risk or security concern. On a standard PW installation, it still only applies to superusers. However, it gives people the possibility to allow editors to generate access tokens.

So instead of

if ($this->user->isSuperuser()) {
  $href = self::API_URL_AUTHORIZE . '?' . http_build_query($request);
  $link = "<a href='$href'>" . __('get Access Token') . "</a>";
}

it's

if ($this->user->isSuperuser() || $this->user->hasPermission('module-admin')) {
  $href = self::API_URL_AUTHORIZE . '?' . http_build_query($request);
  $link = "<a href='$href'>" . __('get Access Token') . "</a>";
}

(There's a second check somewhere further down).

Thanks for considering this. I forked the module for now, but would much rather like this to be incorporated into master.

  • Like 2

Share this post


Link to post
Share on other sites
On 6/14/2018 at 9:06 AM, MarcoPLY said:

I still see this error in the log page every time some one visit the page:  [InstagramFeed]: No user 'xxx' was found. 

1

I have this same problem. Has anyone found a solution?

  • Like 1

Share this post


Link to post
Share on other sites

What is the recommedned way of getting another user's recently images? Am I right in saying in sandbox mode only the dev user can display their content, so it's needed to use the profile's account to setup the dev tokens etc, or is there a way of adding another username to the sandbox so I can query their images...

Bit confusing sorry, but I can only display my own images currently, no matter what I add to the module options.

Share this post


Link to post
Share on other sites

@benbyf

To save myself from the headaches, I only use scrapers anymore. No sandboxed accounts, no setup, no invalidated keys every two weeks. instagram-php-scraper has been working great so far. This is all there is to getting recent media of any user id or name:

$userid = env('INSTAGRAM_USER_ID');

$instagram = new \InstagramScraper\Instagram();
$account = $instagram->getAccountById($userid);
$username = $account->getUsername();
$latestMedia = $instagram->getMedias($username, 10);

foreach ($latestMedia as $media) {
	if ($media->getType() === 'image') {
		[...]
	}
}

 

  • Like 1

Share this post


Link to post
Share on other sites

@d'Hinnisdaël holy smokes, so shocking to me that their APi is so bad that we have to resort to this sort of thing 😦

Share this post


Link to post
Share on other sites
Just now, benbyf said:

@d'Hinnisdaël holy smokes, so shocking to me that their APi is so bad that we have to resort to this sort of thing 😦

True. Many of the recent API updates are about privacy, which is a good thing. But the rollout was more than ideal. And I'd love to go the official way and use their API. But I get emails from clients every other week, asking about invalidated API tokens after they log in from a hotel wifi. And setting up API tokens is quite the hassle. So yeah, it's scrapers for now…

Share this post


Link to post
Share on other sites
Quote

 

To continuously improve Instagram users' privacy and security, we are accelerating the deprecation of Instagram API Platform, making the following changes effective immediately. We understand that this may affect your business or services, and we appreciate your support in keeping our platform secure.

These capabilities will be disabled immediately (previously set for July 31, 2018 or December 11, 2018 deprecation). The following will be deprecated according to the timeline we shared previously:

  • Public Content - all remaining capabilities to read public media on a user's behalf on December 11, 2018
  • Basic - to read a user’s own profile info and media in early 2020

For your reference, information on the new Instagram Graph API.

 

https://www.dropbox.com/s/tl5zgx9h7iormf8/Screenshot 2018-12-10 13.53.46.png?dl=0

 

Just seen this on the instagram developer portal. I had a quick play with the facebook API explorer but couldn't get it to work as wanted (just display another user's profile image). Think we'll need to get going with this as instagram is stopping support for it's own API 😦

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Pages At Bottom
      Keeps selected pages at the bottom of their siblings.
      A "bottom page" will stay at the bottom even if it is drag-sorted to a different location or another page is drag-sorted below it (after Page List is refreshed the bottom page will still be at the bottom).
      Newly added sibling pages will not appear below a bottom page.
      The module also prevents the API methods $pages->sort() and $pages->insertAfter() from affecting the position of bottom pages.
      Note: the module only works when the sort setting for children on the parent page/template is "Manual drag-n-drop".
      Why?
      Because you want some pages to always be at the bottom of their siblings for one reason or another. And someone requested it. 🙂
      Usage
      Install the Pages At Bottom module.
      Select one or more pages to keep at the bottom of their siblings. If you select more than one bottom page per parent then their sort order in the page list will be the same as the sort order in the module config.

       
      https://github.com/Toutouwai/PagesAtBottom
      https://modules.processwire.com/modules/pages-at-bottom/
    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Github: https://github.com/MoritzLost/TextformatterPageTitleLinks
      ---
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.