I have set up two groups, SampleGroup and SampleGroup2. Both have different members. The members have been subscribed to all content.

When I add an article, notifications are only sent to the last group specified in the article. So, when SampleGroup and SampleGroup2 have been tagged, only the members of SampleGroup2 will receive a notification.

I have observed this on two production sites and have reproduced it on a clean install.

Comments

edvanleeuwen’s picture

Project: Organic Groups Notifications » Notifications
Version: 7.x-2.x-dev » 7.x-1.x-dev

I think the subscriptions are not retrieved properly in Notifications, so I am changing the project.

edvanleeuwen’s picture

Project: Notifications » Organic Groups Notifications

I think I have found the cause. In og_notifications.inc the function object_value() contains

        if (array_key_exists('node', $node_groups)) {
          // array_pop() in array_pop() causes php errors, so we need a temp variable.
          $temp = array_pop($node_groups);
          return array_pop($temp);
        }
        else {
          return array_pop($node_groups);
        }

If this just returns the array_pop($node_groups), everything seems to be fine. But obviously, the double pop is there for a reason. I am not sure how to solve this.

edvanleeuwen’s picture

Priority: Normal » Major

Changing the priority to Major.

edvanleeuwen’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

Changed version.

edvanleeuwen’s picture

Status: Active » Closed (duplicate)
Issue tags: +1671316
Related issues: +#1671316: Error after enabling this module 7.x-2.x-dev. Undefined variable: gid

Turned out to be caused by a patch. Following up there.

edvanleeuwen’s picture

Status: Closed (duplicate) » Active

I am reopening this, as this occurs with the current dev version (without the patch in the related issue).

edvanleeuwen’s picture

Priority: Major » Critical

This problem still persists. Effect is that no more than one og can be related to content, as only the last one is notified.

edvanleeuwen’s picture

Assigned: Unassigned » edvanleeuwen
Status: Active » Needs review
StatusFileSize
new410 bytes

The solution seems easy: in object_value replace
return array_pop($entity_group);
with
return $entity_group;

Patch attached.

edvanleeuwen’s picture

What can I do to have this tested and reviewed?

indigoxela’s picture

StatusFileSize
new961 bytes

I think this issue needs a different approach.
It is not correct to take only the last group, using "all" is even worse as the link text says "..in the current group".
There can be hundreds of organic groups on a site and many of them listed in og_group_ref in random order.

We need to get the current group, which requires og submodule og_context.

Patch is attached.

jacob.embree’s picture

Assigned: edvanleeuwen » Unassigned
Status: Needs review » Reviewed & tested by the community
Issue tags: -1671316

I believe #8 is correct. It worked for me.

#10 does not fix the issues.

jacob.embree’s picture

lokapujya’s picture

Issue tags: +Needs manual testing

We either need to add automated tests, or someone has to test it and show the results.