protected function FeedsUserProcessor::existingItemId in Feeds 7
Same name and namespace in other branches
- 6 plugins/FeedsUserProcessor.inc \FeedsUserProcessor::existingItemId()
Get id of an existing feed item term if available.
Overrides FeedsProcessor::existingItemId
1 call to FeedsUserProcessor::existingItemId()
- FeedsUserProcessor::process in plugins/
FeedsUserProcessor.inc - Implements FeedsProcessor::process().
File
- plugins/
FeedsUserProcessor.inc, line 200 - FeedsUserProcessor class.
Class
- FeedsUserProcessor
- Feeds processor plugin. Create users from feed items.
Code
protected function existingItemId(FeedsImportBatch $batch, FeedsSource $source) {
// Iterate through all unique targets and try to find a user for the
// target's value.
foreach ($this
->uniqueTargets($batch) as $target => $value) {
switch ($target) {
case 'name':
$uid = db_query("SELECT uid FROM {users} WHERE name = :name", array(
':name' => $value,
))
->fetchField();
break;
case 'mail':
$uid = db_query("SELECT uid FROM {users} WHERE mail = :mail", array(
':mail' => $value,
))
->fetchField();
break;
case 'openid':
$uid = db_query("SELECT uid FROM {authmap} WHERE authname = :authname AND module = 'openid'", array(
':authname' => $value,
))
->fetchField();
break;
}
if ($uid) {
// Return with the first nid found.
return $uid;
}
}
return 0;
}