{"id":701,"date":"2012-12-05T03:23:00","date_gmt":"2012-12-05T03:23:00","guid":{"rendered":"http:\/\/ursula-smith.com\/mixed-media\/?p=701"},"modified":"2014-01-31T02:33:42","modified_gmt":"2014-01-31T07:33:42","slug":"drupal-7-instagram-feed","status":"publish","type":"post","link":"https:\/\/ursula-smith.com\/mixed-media\/drupal-7-instagram-feed\/","title":{"rendered":"Drupal 7 Instagram Feed"},"content":{"rendered":"<p>I wanted to add an Instagram feed to the Creative Clearinghouse site, and was struggling to find the right way to do it in Drupal. I searched all over and tried using the Drupagram module (it worked but not exactly what I needed), and started looking into the Feeds module. Then I stepped back and thought &#8220;Keep it Simple, Stupid&#8221;. One other time I had been searching for an answer to something I was trying to do in Drupal, and many searches later I had no results. It wasn&#8217;t that there were search results that were wrong or old or whatever, there was just a lack of search results from people complaining that they had an issue like I was perceiving I had. Until I realized the answer was so blatantly simple that a novice would even be able to figure it out. I was just waaaaaay overthinking it.<\/p>\n<p>And so this time, I started thinking along those same lines. I probably was over thinking it. All I wanted to do was get some Instagram pictures that were hash tagged with #creativeclearinghouse. There is an RSS feed from Instagram that does that. There is an Aggregator module in Drupal 7 that pulls in feeds. So I gave that a whirl. It worked with views and presto, I had my Instagram feed!<\/p>\n<p>First I set up a feed under the Aggregator module configuration to the feed URL- <a href=\"http:\/\/instagram.com\/tags\/yyy\/feed\/recent.rsswhere\">http:\/\/instagram.com\/tags\/yyy\/feed\/recent.rsswhere<\/a> yyy is a hashtag. Then I created a view that was created using an Aggregator feed type. Here is a great tutorial on how to do that &#8211;<a href=\"http:\/\/drupal.ucar.edu\/forum\/node\/155\" target=\"_blank\"> http:\/\/drupal.ucar.edu\/forum\/node\/155<\/a> .<\/p>\n<p>I ended up tweaking the Aggregator module. I know, I know this is NOT what you are supposed to do!!! However, I wanted to link back to the Instagram author and show the caption. These are not pulled in now by the Aggregator module. I wanted&#160; the author to be set to the value of the media:credit tag and the description to be set to the media:title tag. so I added the following:<\/p>\n<p>&#160;<\/p>\n<p>&#160;&#160;&#160; \/\/ Resolve dc:creator tag as the item author if author tag is not set.<br \/>&#160;&#160;&#160; if (empty($item[&#8216;author&#8217;]) &amp;&amp; empty($item[&#8216;dc:creator&#8217;]) &amp;&amp; !empty($item[&#8216;media:credit&#8217;])) {<br \/>&#160;&#160;&#160;&#160;&#160; $item[&#8216;author&#8217;] = $item[&#8216;media:credit&#8217;];<br \/>&#160;&#160;&#160; }<\/p>\n<p>&#160;<\/p>\n<p>after:<\/p>\n<p>&#160;&#160;&#160; \/\/ Resolve dc:creator tag as the item author if author tag is not set.<br \/>&#160;&#160;&#160; if (empty($item[&#8216;author&#8217;]) &amp;&amp; !empty($item[&#8216;dc:creator&#8217;])) {<br \/>&#160;&#160;&#160;&#160;&#160; $item[&#8216;author&#8217;] = $item[&#8216;dc:creator&#8217;];<br \/>&#160;&#160;&#160; }<\/p>\n<p>&#160;<\/p>\n<p>Also after:<\/p>\n<p>&#160;&#160; }<br \/>&#160;&#160;&#160; elseif (!empty($item[&#8216;content&#8217;])) {<br \/>&#160;&#160;&#160;&#160;&#160; $item[&#8216;description&#8217;] = $item[&#8216;content&#8217;];<br \/>&#160;&#160;&#160; }<\/p>\n<p>I added:<\/p>\n<p>&#160;&#160;&#160; elseif (!empty($item[&#8216;media:title&#8217;])) {<br \/>&#160;&#160;&#160;&#160;&#160; $item[&#8216;description&#8217;] = $item[&#8216;media:title&#8217;];<br \/>&#160;&#160;&#160; }<\/p>\n<p>&#160;&#160; This was in the modules parser.inc file.<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Update 6\/5\/2013:<\/strong><\/span><\/p>\n<p>&#160;<\/p>\n<p>I think what folks might be missing is this: in my view for the Aggregator View, I played around with the fields.<\/p>\n<p>I have 5 fields:<\/p>\n<p>Aggregator: Item ID (which I hide from display)<br \/>Aggregator: Author (which I used the option to rewrite the results)<br \/>Aggregator: Link (which I hide from display)<br \/>Aggregator: Title (which I hide from display)<br \/>Aggregator: Link (which I used the option to rewrite the results)<br \/>Aggregator: Body (which I used the option to rewrite the results)<\/p>\n<p>For the Aggregator: Author field, I used the option to rewrite the results like so:<\/p>\n<p>from [author]:<\/p>\n<p>and I output the results as a link like so:<br \/><a href=\"http:\/\/instagram.com\/[author]\">http:\/\/instagram.com\/[author]<\/a><\/p>\n<p>I checked off &#8220;external server&#8221; and &#8220;title text&#8221; was set to:<br \/>[author]<\/p>\n<p>I set the Aggregator: Link field and the Aggregator: Title field to not display.<\/p>\n<p>I added a second Aggregator: Link field and used the rewrite the results option with the following value:<\/p>\n<p>&lt;a href=&#8221;[link_1]&#8221;&gt;&lt;img src=&#8221;[link_1]&#8221; width=&#8221;300px&#8221; \/&gt;&lt;\/a&gt;&lt;br\/&gt;<\/p>\n<p>and hid the results if empty.<\/p>\n<p>For the Aggregator: Body field I also used rewriting and set the value to:<\/p>\n<p>[description] &lt;br\/&gt;&lt;br\/&gt;<\/p>\n<p>Hope this helps!<\/p>\n<div class=\"item_footer\">\n<p><small><a href=\"http:\/\/easyscraps.com\/blog\/blog6.php\/drupal-7-instagram-feed\">Original post<\/a> blogged on <a href=\"http:\/\/www.EasyScraps.com\/blogTech.php\/\">Easy Scraps Blog- Tech Corner<\/a>.<\/small><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to add an Instagram feed to the Creative Clearinghouse site, and was struggling to find the right way&#8230;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[],"class_list":["post-701","post","type-post","status-publish","format-standard","hentry","category-digital-posts","category-tech-tips"],"_links":{"self":[{"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/posts\/701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/comments?post=701"}],"version-history":[{"count":1,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/posts\/701\/revisions"}],"predecessor-version":[{"id":2181,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/posts\/701\/revisions\/2181"}],"wp:attachment":[{"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/media?parent=701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/categories?post=701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ursula-smith.com\/mixed-media\/wp-json\/wp\/v2\/tags?post=701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}