You are here

function _pmperson_migrate_associate_user_with_pmperson in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmperson/includes/pmperson.migrate.inc \_pmperson_migrate_associate_user_with_pmperson()
  2. 7.2 pmperson/includes/pmperson.migrate.inc \_pmperson_migrate_associate_user_with_pmperson()

Associate user with newly created pmperson acount.

2 calls to _pmperson_migrate_associate_user_with_pmperson()
pmperson_migrate_create_users_if_required in pmperson/includes/pmperson.migrate.inc
Creates Drupal User and associate it with pmperson node.
pmperson_migrate_fix_existing_users_form_submit in pmperson/includes/pmperson.migrate.inc
Form submit function for automatching Drupal users to PM Persons.

File

pmperson/includes/pmperson.migrate.inc, line 416
Migration functions for the PM Person module.

Code

function _pmperson_migrate_associate_user_with_pmperson($record, $account) {

  // If $account is empty or is for anonymous user.
  if (!$record or !$record->nid or !$account or !$account->uid) {
    watchdog('pmperson', 'message', array(
      'record' => $record,
    ), WATCHDOG_NOTICE);
    return FALSE;
  }
  db_update('pmperson')
    ->fields(array(
    'user_uid' => $account->uid,
    'email' => $account->mail,
  ))
    ->condition('nid', $record->nid)
    ->execute();
  return TRUE;
}