function flickr_photos in Flickr 6
Same name and namespace in other branches
- 5 flickr.module \flickr_photos()
- 7 flickr.module \flickr_photos()
1 string reference to 'flickr_photos'
- flickr_menu in ./
flickr.module - Implements hook_menu().
File
- ./
flickr.module, line 176
Code
function flickr_photos($user = NULL) {
global $pager_page_array, $pager_total, $pager_total_items;
// Set this to something else if you want multiple pagers.
$element = 0;
$pager_page_array[$element] = empty($_GET['page']) ? 0 : (int) $_GET['page'];
if ($user === NULL) {
$nsid = variable_get('flickr_default_userid', '');
if (!$nsid) {
drupal_set_message(t('No default Flickr user id has been set.'));
return FALSE;
}
$uid = 0;
}
else {
$account = $user;
// TODO: We can just use $account as the argument
if ($account->flickr['nsid']) {
// TODO: Were actually storing the "identifier" which is potentially the $nsid
$nsid = $account->flickr['nsid'];
}
else {
drupal_set_message(t('%user does not have a Flickr account', array(
'%user' => $account->name,
)), 'error');
return FALSE;
}
$uid = $account->uid;
}
$nsid = flickr_user_find_by_identifier($nsid);
$photos = flickr_photos_search($nsid, $pager_page_array[$element] + 1);
if (!$photos) {
drupal_set_message(t('No accessible photos found for Flickr %userid', array(
'%userid' => $nsid,
)));
return FALSE;
}
// Set pager information we just acquired.
$pager_total[$element] = $photos['pages'];
$pager_total_items[$element] = $photos['total'];
return theme('flickr_photos', $uid, $photos);
}