[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/migrate/modules/contrib/ -> email_registration.inc (source)

   1  <?php
   2  // $Id: email_registration.inc,v 1.1.2.4 2009/08/23 23:40:46 mikeryan Exp $
   3  
   4  /**
   5   * @file
   6   * Hooks to suport email_registration during user migration
   7   */
   8  
   9  /**
  10   * Implementation of hook_email_registration_name().
  11   *
  12   * If email_registration is in use, it overwrites any explicit username
  13   * with one generated from the email address. If you install the patch at
  14   * http://drupal.org/node/247717, this hook will short-circuit that and
  15   * force the username set in the migration process (possibly randomly
  16   * generated below).
  17   *
  18   * @param $edit
  19   *  The values we passed to user_save().
  20   * @param $account
  21   *  The user account as created by user_save().
  22   * @return
  23   *  The username we've already set - returning this prevents
  24   *  email_registration from overwriting it.
  25   */
  26  function migrate_email_registration_name($edit, $account) {
  27    return $edit['name'];
  28  }
  29  
  30  /**
  31   * Implementation of hook_migrate_prepare_user().
  32   */
  33  function email_registration_migrate_prepare_user(&$newuser, $tblinfo, $row) {
  34    // Generate a random username if none was provided
  35    if (!$newuser['name']) {
  36      // There is a tiny risk that the generated name will not be unique
  37      $newuser['name'] = user_password();
  38    }
  39  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7