You are here

function flickr_user_find_by_identifier in Flickr 5

Same name and namespace in other branches
  1. 6 flickr.inc \flickr_user_find_by_identifier()
  2. 7 flickr.inc \flickr_user_find_by_identifier()

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

1 call to flickr_user_find_by_identifier()
flickr_user in ./flickr.module
Implimentation of the hook_user() Add an extra field for the user to enter his flickr identifier.

File

./flickr.inc, line 374

Code

function flickr_user_find_by_identifier($identifier) {
  if (flickr_is_nsid($identifier)) {

    //identifier is an NSID
    return $identifier;
  }
  if (valid_email_address($identifier) && ($user = flickr_user_find_by_email($identifier))) {
    return $user['nsid'];
  }
  if ($user = flickr_user_find_by_username($identifier)) {
    return $user['nsid'];
  }
  return FALSE;
}