I have a fresh install of Drupal 5.1 and I've entered my api key. I've tried enabling all of them and the random block displayed for a while. When I tried to change the name of the random block it stopped displaying as well (even after I set it back to default). I didn't submit this as a bug because I figured someone else would have seen it first and reported it. Am I doing something wrong?

Comments

BarisW’s picture

The same problem occured to me as well. The Flickr block stopt working when you change a specific setting on the Block-page, like the name or the number of pictures. I worked around this by changing my settings in the flickr.module code however.

Eulinky’s picture

Same issue - eg the block "sets by user" never shows up :(

samo’s picture

_flickr_block_get_userid doesn't look right to me. I don't understand why we are unserializing data from the users table.

Index: ../../modules/flickr/block/flickr_block.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/flickr/block/flickr_block.module,v
retrieving revision 1.3
diff -u -p -r1.3 flickr_block.module
--- ../../modules/flickr/block/flickr_block.module      2 Jan 2007 17:59:11 -0000       1.3
+++ ../../modules/flickr/block/flickr_block.module      14 Feb 2007 03:59:02 -0000
@@ -163,9 +163,9 @@ function flickr_block($op = 'list', $del
 }

 function _flickr_block_get_userid($id) {
-  $result = db_fetch_object(db_query('SELECT data FROM {users} WHERE uid = %d', $id));
-  $data = unserialize($result->data);
-  return $data['nsid'];
+  global $user;
+  $account = user_load(array('uid' => $user->uid));
+  return $account->flickr['nsid'];
 }

 function _flickr_block_recent($user_id, $show_n, $size) {
samo’s picture

the previous diff is wrong.

Index: ../../modules/flickr/block/flickr_block.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/flickr/block/flickr_block.module,v
retrieving revision 1.3
diff -u -p -r1.3 flickr_block.module
--- ../../modules/flickr/block/flickr_block.module      2 Jan 2007 17:59:11 -0000       1.3
+++ ../../modules/flickr/block/flickr_block.module      14 Feb 2007 04:06:59 -0000
@@ -163,9 +163,8 @@ function flickr_block($op = 'list', $del
 }

 function _flickr_block_get_userid($id) {
-  $result = db_fetch_object(db_query('SELECT data FROM {users} WHERE uid = %d', $id));
-  $data = unserialize($result->data);
-  return $data['nsid'];
+  $account = user_load(array('uid' => $id));
+  return $account->flickr['nsid'];
 }

 function _flickr_block_recent($user_id, $show_n, $size) {
ben soo’s picture

Me too: no block display most of the time. Once in a while if i mess with the block settings enough in admin/build/block then flickr a thumbnail block will show up: only one block though no matter how many i configure on the page sidebars, and only until i mess with the block settings again. Latest HEAD modules don't do anything for me.

b

theHawke’s picture

I too just installed flicker, entered my key and shared secret thing along with the userid and enabled the block. But does it show? Nope. I DID change the name of the block.

htxt’s picture

Same here, but I found if you fill in your Flickr User ID for each block they do show up.

theHawke’s picture

You are right. I had to enter the odd-looking user id, not the one I sign into the flickr site with. Now the block is showing! Thanks for the tip.

dgrant’s picture

I've having the same problem.

FarmGrrl’s picture

Me too. It seems impossible to get it back working again after you change the block title (even if you change it back).

hayesr’s picture

StatusFileSize
new803 bytes

When the block tries to get the user_id it's expecting variable_get() to return the user_id or to find nothing and return $default_userid. It seems to me that instead of this, variable_get() is returning an empty value for "flickr_block_{$delta}_user_id" and thereby breaking the block. My solution was to check for an empty value when the block is saved and save the default user id if it is. This ensures that there will always be something for variable_get() to get.

There may be a better way of doing this (I'm not a professional programmer) but it worked for me.

hayesr’s picture

Category: support » bug
Status: Active » Needs review

I'm changing the status and nature of this issue.

beginner’s picture

StatusFileSize
new870 bytes

Here's the same patch, but diffed against the cvs repository.

drewish’s picture

Status: Needs review » Fixed
StatusFileSize
new7.07 KB

here's the patch i'm committing to fix this. it moves the three variables for each block into a single variable.

telex4’s picture

Status: Fixed » Active

I've just downloaded and installed the module from HEAD and I'm getting the same problem. None of the blocks show.

I've checked that I do indeed have the latest code, put in the API and shared API key that I just applied for, checked and double checked my flickr ID, and tried several different blocks, but none of them show up.

andrewlevine’s picture

Some of the blocks should show if you have put in the default NSID, but flickr_block is still very flaky right now. This issue should fix most of the problems: http://drupal.org/node/136317

telex4’s picture

Status: Active » Fixed

Thanks andrewlevine, that patch fixed it.

Anonymous’s picture

Status: Fixed » Closed (fixed)