The following code has been added to spaces_og.module in the 6.x-3.2 release, and it seems to be breaking my site (it was included via the latest openatrium release).
Specifically, the node object being passed into this function has og_groups defined as an associative array of arrays, so it is calling spaces_load with an array as the second argument.
I believe the problem is due to my use of the Content Profile module, so the node object, which in this case is a node profile object, has og_groups overloaded with the groups to which the user belongs, rather than the expected list of groups to which the node itself belongs.
An easy fix would be to test the type of the og_groups property of the object, but perhaps there's a deeper issue here.
/**
* Implementation of hook_spaces_get_space_from_object().
*/
function spaces_og_spaces_get_space_from_object($type, $object) {
if ($type == 'node') {
if (og_is_group_type($object->type)) {
return spaces_load('og', $object->nid);
}
elseif (!empty($object->og_groups)) {
reset($object->og_groups);
return spaces_load('og', current($object->og_groups));
}
}
}
Comments
Comment #1
hefox commentedThe $node object being corrupted isn't a fault with spaces. Fix the module or such that is messing it up, nay?