You are here

function userreference_node_import_values_alter in Node import 6

Implementation of hook_node_import_values_alter().

File

supported/cck/userreference.inc, line 41
Support file for the CCK User reference module.

Code

function userreference_node_import_values_alter(&$values, $type, $defaults, $options, $fields, $preview) {
  foreach (node_import_cck_fields($type, 'userreference') as $fieldname => $fieldinfo) {
    if ($fieldinfo['widget']['type'] == 'userreference_autocomplete') {
      foreach ($values[$fieldname] as $i => $value) {

        // This is just braindead - because of some wrapper, the value
        // needs to be:
        // array(0 => array('uid' => array('uid' => 'name')))
        // instead of:
        // array(0 => array('uid' => 'name')).
        $values[$fieldname][$i]['uid'] = array(
          'uid' => $values[$fieldname][$i]['uid'],
        );
      }
    }
  }
}