Community Documentation

User Import Framework

Last updated January 4, 2011. Created by dwightaspinwall on January 4, 2011.
Log in to edit this page.

The User Import Framework (uif) module provides simple, extensible user import via CSV (comma-separated value) files. The guiding philosophy is to make the import process as simple as possible for the end-user (the user doing the import). Hooks allow the developer (you) to add the bells and whistles you need, e.g. content_profile support, while providing a framework which takes care of the tedious aspects of the job (forms, input parsing).

Please visit the module page for more information and downloads.

The purpose of this documentation page is to allow developers to contribute code examples they have created to solve specific user import cases. These will often involved integration with other modules. To create an example, click the "Add child page" link at the bottom of this page.

Thank you for your contributions to the documentation.

Comments

Setting the value of custom fields on import

Here is an example of how to set the value of custom fields on import rather than having them set in the CSV:

<?php
/**
* Implements hook_uif_pre_create().
*
* Enter description here ...
* @param unknown_type $account
* @param unknown_type $user_data
*/
function example_uif_pre_create($account, $user_data) {
   
$fields = array();
   
    if (
$account->mail == 'test@example.com') {
       
$fields['field_chosen_one'][LANGUAGE_NONE][0]['value'] = TRUE;
    }
   
    if (!empty(
$user_data['field_messiah'])) {
       
$fields['field_is_the_messiah'][LANGUAGE_NONE][0]['value'] = TRUE;
    }
   
    return
$fields;
}
?>

Hope this helps anyone wanting to set field values when importing a user.

Cheers

Tom

Bristol based Drupal web design
BlackLabel Web Design

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x
Audience
Programmers

Site Building Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.