You are here

function flickrapi_get_user_nsid in Flickr API 5

Same name and namespace in other branches
  1. 6 flickrapi.module \flickrapi_get_user_nsid()
  2. 7.2 flickrapi.module \flickrapi_get_user_nsid()
  3. 7 flickrapi.module \flickrapi_get_user_nsid()

Tries to match an 'identifier' onto a flickr nsid

This function will first see whether $identifier is allready a nsid (format check only, no api call). If it is not and the identifier has the format of an email, an api call will be made to check whether there is an nsid for that email. If this is not the case, the $identifier is treated as a username and an api call is made to find the nsid for that username.

If none of these succees, the result will be false

Parameters

$identifier: identifier to find an nsid for

Return value

valid nsid or false if none can be found

File

./flickrapi.module, line 118

Code

function flickrapi_get_user_nsid($identifier) {
  if (flickrapi_is_nsid($identifier)) {

    //identifier is an NSID
    return $identifier;
  }
  $f = flickrapi_phpFlickr();
  if (valid_email_address($identifier) && ($user = $f
    ->people_findByEmail($identifier))) {
    return $user['nsid'];
  }
  if ($user = $f
    ->people_findByUsername($identifier)) {
    return $user['nsid'];
  }
  return FALSE;
}