function flickr_photos in Flickr 7
Same name and namespace in other branches
- 5 flickr.module \flickr_photos()
- 6 flickr.module \flickr_photos()
Flickr photos (as shown on a user profile).
1 string reference to 'flickr_photos'
- flickr_menu in ./
flickr.module - Implements hook_menu().
File
- ./
flickr.module, line 211 - The Flickr module.
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;
if ($account->flickr['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,
)), 'warning');
return FALSE;
}
// Set pager information we just acquired.
$pager_total[$element] = $photos['pages'];
$pager_total_items[$element] = $photos['total'];
return theme('flickr_photos', array(
'uid' => $uid,
'photos' => $photos,
));
}