Here is how the application is structured:

It was built this way to add moderation of images, so that when an image is unpublished, it wont show up in the gallery. The publish and unpublish aspect works through a tool page where there is an additional flag to remove from the queue as well.

Question is: Since the gallery view is based on the values stored on an instagram node in contenttype.
Is there a way to update the value for the likes count field without having to make a call to the API everytime any user goes to the gallery page?
Otherwise the 'like' counts stored on the article become outdated.

Let me know if I can provide more info.


I don't know anything about the Instagram API, but if you want to keep the like counters up to date you will need to make API calls at some point.

If you expect many viewers then as you say, you probably don't want to make that call every time a user goes to the gallery, I would suggest adding another function to cron that iterates through your currently active Instagram content and refreshes the like counter.

  • Thanks for the response.Yes thats the general plan now, I have noticed some sites being able to show count in real-time and was wondering what they are doing in this case. Thus any alternative approaches.
    – pal4life
    Oct 21 '14 at 22:25
  • They're probably not importing the content, choosing to embed it instead.
    – Darvanen
    Oct 21 '14 at 22:58

There exist a module that integrates instagram with drupal check and see if it could help with your approach drupagram


If you want realtime, you're going to have to use JavaScript like node or something to get true real time.


Have a look at the Menu Badges module to add such notifications to any menu item and/or menu tab of your choice.

Here are some details about it (from its project page):

Provides a method for adding iOS-style badges to menu items. (see screenshot)

enter image description here

Adding Badges to Menus

Once enabled, go to Administration > Structure > Menus, and click "list links" next to the menu containing the target item. Click "edit" next to the item and select the badge to display with the Display Menu Badge select box.

Adding Badges to Tabs

For adding badges to menu tabs, there is a tab under Administration > Structure > Menus called "Tab Menu Badges". Search for the menu router path of the tab you want to alter, then select a badge from the corresponding select box.

Badge Types

The module includes five example badges, and new badges can be created easily with Views. Modules can also supply their own badges with a hook implementation. See the README.txt file for details.

Because of how it integrates with the Views module, you basically reduce the solution for any type of notification to something like "Just create an appropriate view of it". And as per your "... it creates a new article on the instagram content type ..." in your question, it should be straight forward to have such view only count the articles of instagram content type that are "new".

Video tutorials:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.