summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--includes/og.rules.inc19
1 files changed, 15 insertions, 4 deletions
diff --git a/includes/og.rules.inc b/includes/og.rules.inc
index f351ef4..fbf45b0 100644
--- a/includes/og.rules.inc
+++ b/includes/og.rules.inc
@@ -123,9 +123,7 @@ function og_rules_action_info() {
* Action: Subscribe user to group.
*/
function og_rules_action_subscribe_user($user, $node, $settings) {
- if (!og_is_group_member($node->nid, $user)) {
- og_save_subscription($node->nid, $user->uid, array('is_active' => (int)$settings['is_active']));
- }
+ og_save_subscription($node->nid, $user->uid, array('is_active' => (int)$settings['is_active']));
}
/**
@@ -224,10 +222,23 @@ function og_rules_condition_info() {
* Condition: User is group member.
*/
function og_rules_condition_user_in_group($user, $node, $settings) {
- return !empty($node->nid) && og_is_group_member($node->nid, $user);
+ return !empty($node->nid) && og_is_group_member($node->nid, $settings['include_admins'], $user->uid);
}
/**
+ * Condition: User is group member.
+ */
+function og_rules_condition_user_in_group_form($settings, &$form) {
+ $form['settings']['include_admins'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Include admins'),
+ '#description' => t('When enabled, users with "administer nodes" permission will always be treated as group members.'),
+ '#default_value' => $settings['include_admins'],
+ );
+}
+
+
+/**
* Condition: Content is a group node.
*/
function og_rules_condition_content_is_group($node, $settings) {