You are here

public function FeedsUserProcessor::setTargetElement in Feeds 7.2

Same name and namespace in other branches
  1. 6 plugins/FeedsUserProcessor.inc \FeedsUserProcessor::setTargetElement()
  2. 7 plugins/FeedsUserProcessor.inc \FeedsUserProcessor::setTargetElement()

Overrides setTargetElement() to operate on a target item that is an user.

Overrides FeedsProcessor::setTargetElement

File

plugins/FeedsUserProcessor.inc, line 290
Contains FeedsUserProcessor.

Class

FeedsUserProcessor
Feeds processor plugin. Create users from feed items.

Code

public function setTargetElement(FeedsSource $source, $target_user, $target_element, $value, array $mapping = array()) {
  switch ($target_element) {
    case 'pass':
      $this
        ->setPassTarget($source, $target_user, $target_element, $value, $mapping);
      break;
    case 'created':
      $target_user->created = feeds_to_unixtime($value, REQUEST_TIME);
      break;
    case 'language':
      $target_user->language = strtolower($value);
      break;
    case 'roles_list':

      // Ensure that the role list is an array.
      $value = (array) $value;
      $this
        ->rolesListSetTarget($source, $target_user, $target_element, $value, $mapping);
      break;
    case 'timezone':
      $target_user->timezone = $value;
      break;
    default:
      parent::setTargetElement($source, $target_user, $target_element, $value);
      break;
  }
}