Drupal Flickr Module. Now With URLs!

- - posted in drupal, php | Comments

Okay, so I’ve been a bit preoccupied with a couple projects which have slowed my efforts at blogging etc.

In both cases, I’ve been working on websites that leverage the PHP based Drupal CMS.  One of those projects is over at http://www.chasejarvisshoeproject.com.  That site is basically a small community forum for some folks that are sending a pair of shoes around the world, and taking pictures of them in various locations and situations.  Pretty cool.  The result of this effort is a Flickr photo pool and a good time.

So, of course a website devoted to a group on Flickr, is going to require some integration with Flickr.  Enter the Drupal Flickr Module.  When I started using it, this module was still in either an alpha, or beta (can’t seem to remember) and has released it’s 1.0 as of the 25th of March.  Throughout the time I’ve been using it however, there’ve been a few functions of the Flickr API which I needed, and the module didn’t support.  Those were.

Since the framework of the module did the hard work of making the calls, it was easy to write my own methods which performed these Flickr API functions for me.  And as the module developers released new versions, I just copy/pasted my code back into the new file, and went about my business.

Well when 1.0 was released, I took a closer look.  It turns out they’d implemented the call to get photos from a group pool, but still nothing for the URL’s.  So I figured I’d contribute and write a patch for the two calls I was still in need of.  And that, is what you see here.

569,597d568
< }
< 
< /** 
<  * @param $nsid
<  *   nsid of the group whose pool url will be returned
<  * @return 
<  *   The URL portion of the response from the flickr method flickr.urls.getGroup
<  */
< function flickr_urls_get_group($nsid)
< {
<   $response = flickr_request('flickr.urls.getGroup', array('group_id' => $nsid));
< if($response)
<     return $response['group']['url'];
<     
<   return FALSE;
< }
< 
< /**
<  * @param $nsid
<  *   nsid of the user whose photostream url will be returned
<  * @return unknown_type
<  */
< function flickr_urls_get_user_photos($nsid)
< {
<   $response = flickr_request('flickr.urls.getUserPhotos', array('user_id' => $nsid));
< if($response)
<     return $response['user']['url'];
<     
<   return FALSE;

As you can see, pretty basic but I figured I’d contribute.  I posted this as a feature request/issue over on the Flickr Module’s issue queue, but have yet to receive a response.  If nothing else, I can use this to patch the next version.  Hopefully it helps someone else as well.

Comments