? .git Index: og.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og/Attic/og.module,v retrieving revision 1.628.4.49 diff -u -p -r1.628.4.49 og.module --- og.module 21 Dec 2010 07:51:13 -0000 1.628.4.49 +++ og.module 8 Feb 2011 22:46:47 -0000 @@ -373,6 +373,39 @@ function og_is_group_member($gid, $inclu } /** + * Determine the moderated groups a user has petitioned to join. + * + * @param gid + * An integer or a node object representing the group node. + * @param $uid + * Pass a user id, or pass NULL in order to check current user. + * @param $reset + * If TRUE, the cached user object (if any) will be reset for the given $uid + * (or the current $user if $uid is NULL). + * + * @return + * Whether the user is a pending member of the specified group. If no $gid is specified, + * will return an array of all pending groups. + */ +function og_is_pending_member($gid = NULL, $uid = NULL, $reset = FALSE) { + static $pending; + + if (!isset($uid)) { + $uid = $GLOBALS['user']->uid; + } + + if (empty($pending[$uid]) || $reset) { + $pending[$uid] = array(); + $groups = array_diff(og_get_subscriptions($nid, 0, $reset), og_get_subscriptions($nid, 1)); + foreach ($groups as $gid => ) { + $pending[$uid][$gid] = $gid; + } + } + return isset($gid) ? in_array($gid, $pending[$uid]) : $pending[$uid]; +} + + +/** * Determine whether user can act as a group administrator for a given group. * * @param string $node @@ -2398,9 +2431,18 @@ function og_block_details() { return array($txt, $subscription); } +/** + * Create a link for user to subscribe to a group. + * + * @param $node + * Pass the group node object. + */ function og_subscribe_link($node) { if ($node->og_selective == OG_MODERATED) { $txt = t('Request membership'); + if (og_is_pending_member($node->nid)) { + return t('Awaiting approval'); + } } elseif ($node->og_selective == OG_OPEN) { $txt = t('Join'); Index: og.pages.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og/Attic/og.pages.inc,v retrieving revision 1.1.2.9 diff -u -p -r1.1.2.9 og.pages.inc --- og.pages.inc 2 Oct 2010 17:52:56 -0000 1.1.2.9 +++ og.pages.inc 8 Feb 2011 22:46:47 -0000 @@ -318,17 +318,20 @@ function og_confirm_subscribe($form_stat '#title' => t('Additional details'), '#description' => t('Add any detail which will help an administrator decide whether to approve or deny your membership request.') ); + $submit_label = t('Request membership'); } else { $form['request'] = array( '#type' => 'value', '#value' => '', ); + $submit_label = t('Join'); } + return confirm_form($form, t('Are you sure you want to join the group %title?', array('%title' => $node->title)), 'node/'. $node->nid, ' ', - t('Join'), t('Cancel')); + $submit_label, t('Cancel')); } /**