Problem/Motivation

There appears to be a typo in commons_trusted_contacts.module line 476:

function commons_trusted_contacts_og_membership_delete(OgMembership $og_membership, $type) {

$type is not a valid parameter for hook_og_membership_delete() in OG API.

Proposed resolution

Remove $type, it is not referenced inside the function.

function commons_trusted_contacts_og_membership_delete(OgMembership $og_membership) {
  if ($og_membership->type != 'trusted_contacts' || $og_membership->group_type != 'user') {
    // Not a Trusted-Contact membership type.
    return;
  }

  if (!og_is_member('user', $og_membership->etid, 'user', $og_membership->gid)) {
    // Prevent recursion.
    return;
  }

  // Delete the "opposite" OG membership too.
  og_ungroup('user', $og_membership->etid, 'user', $og_membership->gid);
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stupiddingo’s picture

Assigned: stupiddingo » Unassigned
Status: Active » Needs review
FileSize
1.85 KB

And patch.

ezra-g’s picture

Issue tags: +Commons 7.x-3.3 radar

Thanks, stupiddingo!

Tagging for review before Commons 3.3 is released.

Devin Carlson’s picture

Version: » 7.x-3.2
Assigned: Unassigned » Devin Carlson
FileSize
722 bytes

stupiddingo@ it looks like you meant to post #1 in #2013433: commons_wikis_og_user_access check $nid does not exist for new user-based groups.

A patch to make the change outlined in the OP.

stupiddingo’s picture

Status: Needs review » Reviewed & tested by the community

The only explanation I can offer is the timestamp of 2am. Sheesh. Devin, your #3 patch above matches mine and works for me on an existing and clean install. Thanks! /brent

Devin Carlson’s picture

Status: Reviewed & tested by the community » Fixed

Committed #3 to Commons Trusted Contacts & Private Messaging 7.x-3.x. Thanks!

http://drupalcode.org/project/commons_trusted_contacts.git/commit/69acd04

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