Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Not exactly a bug, but something that worths a warning. The following code in og_ui_field_formatter_view method could be very slow if you have a large # of group nodes in the audience field:
// Multi-value field.
foreach ($wrapper->{$field_name} as $wrapper_field) {
$id = $wrapper_field->value(array('identifier' => TRUE));
if ($wrapper_field->entityAccess('view')) {
$accessible_ids[$id] = TRUE;
}
else {
$private = TRUE;
}
}
This is because $wrapper_field->entityAccess is calling node_access if your group is a node, and node_access a costly function to call, not something you want to do if there're thousands of nodes.
Comments
Comment #1
amitaibuWhat's your suggestion - not to check access?
Comment #2
jrao CreditAttribution: jrao commentedNot really, I'm just posting it here so that people would be aware of this potential performance issue, since it took me a while to find it. I'm not sure anything should be changed in code, although I vaguely remember query alteration can be used to check access, which is used by views.