users can not delete their subscription requests

jhm - October 8, 2009 - 20:09
Project:Organic groups
Version:5.x-7.4
Component:og.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

When a user requests to join a moderated og, the user will get access denied when clicking on the delete request url.

The reason is that a user can only delete himself (unless admin) from a og. The removal request is compared against user's og_groups. Unfortunately pending requests are not in $user->og_groups (anymore)

og_user load call og_get_subscriptions, but the default says to only load active subscriptions, effectively filtering out all groups with pending requests

function og_get_subscriptions($uid, $min_is_active = 1, $reset = FALSE)

altering og_user load to call og_get_subscription($uid, 0) fixes this.

#1

jhm - October 28, 2009 - 19:16

I just found out that this suggested fix requires another patch in og.module, since with the above change users requesting approval to join a group will not be recognized as such in og_approve

The if statement in og.module:og_approve needs to be augmented as shown

    if (in_array($gid, array_keys($account->og_groups)) && $account->og_groups[$gid]['is_active']) {
      drupal_set_message(t("!name already approved to group %group.", array('!name' => theme('username', $account), '%group' => $node->title)), 'error');
      return '';
    }

because users waiting for approval ARE in fact in og_groups, but is_active is 0

 
 

Drupal is a registered trademark of Dries Buytaert.