Hey,

I am actually fighting with a huge performance issue with Organic Groups and Entity References.
The following setup is given:

I have 20000 Contents of Type "A", every content is a group. Every group has 3 Subcontents "B", so we have 60000 subcontents in total.

On a third content users should only be able to reference content of Type "B" of the groups they belong to, so I created a Entity Reference field and added a view to filter the referencable contents. The list ist filtered using the contextual filter "(OG membership from node) OG membership: Group ID" with the argument: "Provide a default value -> The OG groups of the logged in user" (see attached screeshot). All this is working very smooth for users with just 1 or 2 groups.

The problem I have is with content administrators. I have two content administrators, the first one is responsible for the first 10000 groups and the second one for the rest. Both content administrators cant use the reference field at all (it is set to autocomplete), cause they recieve a time out.

After a bit of debugging I found out why this is happening. Without the contextual filter "(OG membership from node) OG membership: Group ID" anything is working fine, and the autocomplete is doing its job. But when I add it to the view AND set the argument selection to "Provide a default value -> The OG groups of the logged in user", the function "og_get_groups_by_user($account = NULL, $group_type = NULL)" is called which always will cause a timeout for that huge amount of groups that should be loaded.

So currently the contextual filter "(OG membership from node) OG membership: Group ID" couldnt be used for enviroments where users are having more then 1000 groups or above.

Any suggestions or patches to fix that ? :-)

CommentFileSizeAuthor
#3 Screen Shot 2015-04-09 at 11.51.46.png172.21 KBsgurlt
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sgurlt’s picture

Issue summary: View changes
sgurlt’s picture

Issue summary: View changes
sgurlt’s picture

Issue summary: View changes
FileSize
172.21 KB