Hello everyone,

I have a content type called 'Announcements' as a OG Group Post and I want all users to automatically be subscribed to that content type of whatever group they sign up for. I made the following rule:

ON event User subscribes to group
Execute:

global $user;
$subscription = _notifications_subscription_defaults($account);
$subscription['uid'] = $account->uid;
$subscription['type'] = 'announcements';
$subscription['event_type'] = 'node';
$subscription['fields'] = array('$group' => $gid);
notifications_save_subscription($subscription);

The problem is, it subscribes the user to all content types in that group in addition to a new one: Unknown Mail Immediately active edit, drop

I must be doing something wrong here, but I can't figure it out!

Thanks in advance,
Tiuya

Comments

jose reyero’s picture

Status: Active » Fixed
$subscription['fields'] = array('$group' => $gid);
// Subscription to group + content type
$subscription['fields'] = array('group' => $gid, 'type' => 'story');

Anyway you should be able to create these subscriptions from OG subscriptions pages. Also you may like 'Custom Subscriptions' module in http://drupal.org/project/notifications_extra

The subscription type should be possibly 'grouptype' though others are possible too...

Status: Fixed » Closed (fixed)

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