After I migrated my fields from D6 to D7 I get this in all my contents with user references on them:

Warning: array_filter() expects parameter 1 to be array, string given in _user_reference_potential_references_standard() (line 864 of /path/to/drupal/sites\all\modules\references\user_reference\user_reference.module).

Thanks.

Comments

jbeall’s picture

I am encountering this as well, in 7.x-2.0.

Based on just a few minutes of testing, this seemed to fix it:
http://drupal.org/node/1462976#comment-5866428

We'll see how this fix holds up.

-Josh

jfha73’s picture

Status: Active » Fixed

That worked for me.

HLopes’s picture

I think you just need to edit the field and save it. ( something missing in the migrate hooks? )

Something else is wrong earlier on the field configuration.

The problem is that one of the referenced user status is blocked ( 0 ), which means the option "blocked" never gets saved.

  $a = array(
    '0' => 0,           // Blocked user
    '1' => 1            // Active user
  );
  
  print_r(array_filter($a)); // Output = Array ( [1] => 1 );

The array_filter needs to be rethinked, i guess...

  $form['referenceable_status'] = array(
    '#type' => 'checkboxes',
    '#title' => t('User status that can be referenced'),
    '#default_value' => is_array($settings['referenceable_status'])
      ? array_filter($settings['referenceable_status'])
      : array(1),
    '#options' => array(1 => t('Active'), 0 => t('Blocked')),
  );

Can be easily avoided by using a view to list the referenceable users.

jfha73’s picture

Version: 7.x-2.0-beta3 » 7.x-2.x-dev
Status: Fixed » Needs work

Sorry to bother you again with this, but I tried to do this again and it's either I don't remember what I did before or it's just not working for me this time, so let me ask you, can you release a new dev version with the fix included, or a patch for it?

Thanks.

jfha73’s picture

Never mind, I figured it out again, but seriously a new dev file wouldn't hurt

firfin’s picture

Same problem. But easily solved like HLopes wrote in #3

Just save the field configuration again. Problem solved.
You need to do this for every user reference field.

rfay’s picture