Hi All,
We recently upgrade a Drupal 6 site to Drupal 7, and we are getting a warning on our custom content types have have a user-reference field. It only appears when you are editing the content, not when it is being displayed. The error is:
Warning: array_filter() [function.array-filter]:
The first argument should be an array in
_user_reference_potential_references_standard()
(line 864 of
{drupal-path}\sites\all\modules\references\user_reference\user_reference.module).As far as I can tell, everything is working. You can edit the content, changed the user-reference field, and your changes are saved.
I opened up user_reference.module and looked at the offending line. An excerpt is below. Line 864 is the line that starts with $filter_status =. The problem is that $field['settings']['referenceable_status'] is an integer with value 1, and not an array, and array_filter takes an array as a parameter.
Any idea what's going on? Is this a bug or a configuration issue? How can I fix this?
I'm on Drupal 7.12, and References 7.x-2.0
/**
* Helper function for user_reference_potential_references().
*
* List of referenceable users defined by user role and status.
*/
function _user_reference_potential_references_standard($field, $options) {
// Avoid useless work.
$filter_roles = array_filter($field['settings']['referenceable_roles']);
$filter_status = array_filter($field['settings']['referenceable_status']);
if (!count($filter_status) && !count($filter_roles)) {
return array();
}
Comments
I think this bug might be what I'm encountering
I think this bug might be what I'm encountering, but there are few details on the bug report so I'm not sure:
http://drupal.org/node/1462976
Same message after upgrading
Same message after upgrading from 6 to 7.
Went away after I went into config page for that reference field and re-saved its configuration.
Same trick worked for some other small issues, like _text_sanitize().
Same problem
I got Warning: array_filter() expects parameter 1 to be array, string given em _user_reference_potential_references_standard() (linha 864 de /home/insti458/public_html/sites/all/modules/references/user_reference/user_reference.module).
It remains even after saving fields again.
What can I do?
Thanks in advance!
That fixed it for me too
That fixed it for me too :)
Thanks