I was testing out the current og_get_group_audience_fields() function for use in a custom module and I came across a potential issue. If you call og_get_group_audience_fields() twice within the same request and include a different $group_bundle parameter each time, then the second result appears to be the cached result of the first call.

The issue appears to occur because the cache identifier only includes $entity_type . ':' . $bundle_name . ':' . $group_type and does not include the group bundle.

Not sure if this is by design. I was looking for a an easy way to get the group field name for a specific group bundle and needed to call the function twice within the same request for different group bundles. I can work around it, but just wanted to mention it in case it was an unknown bug.

Many thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shushu’s picture

Seems like a bug for me.
Would it be possible to ask for a patch (and maybe even an enhanced test testOgUiAddPeopleMultipleAudienceFields to check it) ?

arnested’s picture

Status: Active » Needs review
FileSize
1.31 KB

Patch added.

arnested’s picture

FileSize
1.17 KB

The patch with the right paths this time.

The last submitted patch, 2: og-incorrect_results-2358929-2.patch, failed testing.

amitaibu’s picture

Status: Needs review » Fixed

Merged, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.