function _media_flickr_get_user_id in Media: Flickr 7.2
Same name and namespace in other branches
- 7 includes/media_flickr.utilities.inc \_media_flickr_get_user_id()
Find Flickr user ID.
Parameters
array $parts:
Return value
string user NSID Return Flickr NSID. If nothing found, returns a empty string.
Throws
\Exception
2 calls to _media_flickr_get_user_id()
- MediaFlickrUtils::testGetUserId in tests/
MediaFlickrUtils.test - Test _media_flickr_get_user_id().
- _media_flickr_build_uri in includes/
media_flickr.utilities.inc - Build the streamwrapper URI if the remote media exists.
File
- includes/
media_flickr.utilities.inc, line 219 - Utility functions for Media: Flickr.
Code
function _media_flickr_get_user_id(array $parts) {
$user_id = '';
if (isset($parts['p'])) {
$media_id = $parts['p'];
$media_info = _media_flickr_sets_request('flickr.photos.getInfo', array(
'photo_id' => $media_id,
));
if ($media_info['@attributes']['stat'] !== 'fail') {
$user_id = $media_info['photo']['owner']['@attributes']['nsid'];
}
}
// It is is a photo set?
if (isset($parts['s'])) {
$media_id = $parts['s'];
$media_info = _media_flickr_sets_request('flickr.photosets.getInfo', array(
'photoset_id' => $media_id,
));
if ($media_info['@attributes']['stat'] !== 'fail') {
$user_id = $media_info['photoset']['@attributes']['owner'];
}
}
return $user_id;
}