I am trying to use user_imports to populate a custom table that I have created.

I managed to get the form_edit to display the column names in the drupal fields dropdown menu (see attachment: modified_dropdown_list.png).

I have created an extension module to do this.

The next step I did was to invoke the after_save() hook.

Upon form submit, i.e. Import, I am unable to retrieve the csv values that have been assigned to these column names.

I performed a var_dump($fields) where all the values are read from. This is the output:

array ( 'profile' => array ( 1 => array ( 0 => 'Gaylene', ), 2 => array ( 0 => 'Weirich', ), ), 'child' => array ( 'fname' => array ( ), 'lname' => array ( ), ), 'user' => array ( 'email' => array ( 0 => 'Omega@example.com', ), ), )stdClass::__set_state(array( 'uid' => '37', 'name' => 'GayleneW', 'pass' => '9e499d8b7c3dbe095920558819e06cfd', 'mail' => 'Omega@example.com', 'mode' => '0', 'sort' => '0', 'threshold' => '0', 'theme' => '', 'signature' => '', 'signature_format' => '0', 'created' => '1348290336', 'access' => '1348290336', 'login' => '0', 'status' => '1', 'timezone' => '-18000', 'language' => '', 'picture' => '', 'init' => 'Omega@example.com', 'data' => 'a:1:{s:7:"contact";i:1;}', 'timezone_name' => '', 'contact' => 1, 'roles' => array ( 2 => 'authenticated user', 7 => 'parent', ), 'profile_name' => '', 'profile_last_name' => '', 'profile_job' => '', 'profile_organization' => '', 'profile_children' => '', 'profile_gender' => '', 'og_groups' => array ( ), 'force_password_change' => '1', 'badges' => array ( 6 => stdClass::__set_state(array( 'bid' => '6', 'weight' => '0', 'name' => 'User', 'image' => 'profiles/drupal_commons/modules/features/commons_reputation/images/bars-0.png', 'href' => '', 'unhideable' => '0', 'fixedweight' => '1', 'doesnotcounttolimit' => '0', 'userweight' => NULL, 'tid' => NULL, 'coalescedweight' => '0', 'class' => 'badge user', )), ), 'badges_all' => array ( 6 => stdClass::__set_state(array( 'bid' => '6', 'weight' => '0', 'name' => 'User', 'image' => 'profiles/drupal_commons/modules/features/commons_reputation/images/bars-0.png', 'href' => '', 'unhideable' => '0', 'fixedweight' => '1', 'doesnotcounttolimit' => '0', 'userweight' => NULL, 'tid' => NULL, 'coalescedweight' => '0', 'class' => 'badge user', )), ), 'user_terms' => array ( ), ))array(3) { ["profile"]=> array(2) { [1]=> array(1) { [0]=> string(7) "Gaylene" } [2]=> array(1) { [0]=> string(7) "Weirich" } } ["child"]=> array(2) { ["fname"]=> array(0) { } ["lname"]=> array(0) { } } ["user"]=> array(1) { ["email"]=> array(1) { [0]=> string(17) "Omega@example.com" } } }

As you can see, child' => array ( 'fname' => array ( ), 'lname' => array ( ), ) is empty although I have assigned values to it.

I need to retrieve these values in order to populate the database. Any help would be greatly appreciated.

CommentFileSizeAuthor
Snapshot 22:09:12 3:11 PM.png98.71 KBlyradmil

Comments

robert castelo’s picture

Status: Active » Postponed (maintainer needs more info)

Have you used hook_user_import_data() to add the data into the workflow?

Example:

/**
 * Implementation of hook_user_import_data().
 */
function field_user_import_data($settings, $update_setting, $column_settings, $module, $field_id, $data, $column_id) {

  if ($module != 'field') return;

  $value = $data[$column_id];
  return $value;
}
gisle’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

It has been six years withno followup from the OP and the Drupal 6 branch is no longer updated. Closing as outdated.