You are here

function spaces_og_subscription_link in Spaces 7.3

Same name and namespace in other branches
  1. 5.2 spaces_og.module \spaces_og_subscription_link()
  2. 5 spaces.module \spaces_og_subscription_link()
  3. 6.3 spaces_og/spaces_og.module \spaces_og_subscription_link()
  4. 6 spaces_og/spaces_og.module \spaces_og_subscription_link()
  5. 6.2 spaces_og/spaces_og.module \spaces_og_subscription_link()
  6. 7 spaces_og/spaces_og.module \spaces_og_subscription_link()

Custom subscription link - use "join" instead of "subscribe" - make it shorter.

File

spaces_og/spaces_og.module, line 440

Code

function spaces_og_subscription_link() {

  /*
  global $user;
  if ($user->uid && is_array($user->og_groups) && $space = spaces_get_space()) {
    $gid = $space->id;
    $node = node_load($gid);

    // User is a member
    if (isset($user->og_groups[$gid])) {
      // Do not let managers leave the group -- TODO: figure out a
      // better workflow for these situations.
      if (!og_is_group_admin($node) && $node->og_selective != OG_CLOSED) {
        return array(
          'title' => t('Leave this group'),
          'href' => "og/unsubscribe/{$node->nid}/{$user->uid}",
          'query' => 'destination=' . $_GET['q'],
        );
      }
    }
    // User has requested membership
    else if (db_query("SELECT count(nid) FROM {og_uid} WHERE nid = :nid AND uid = :uid AND is_active = :is_active", array(':nid' => $gid, ':uid' => $user->uid, ':is_active' => 0))->fetchField()) {
      return array(
        'title' => t('Cancel request to join'),
        'href' => "og/unsubscribe/{$node->nid}/{$user->uid}",
        'query' => 'destination=' . $_GET['q'],
      );
    }
    // User is not a member
    else {
      if ($node->og_selective == OG_MODERATED) {
        return array(
          'title' => t('Request to join'),
          'href' => "og/subscribe/" . $node->nid,
          'query' => 'destination=' . $_GET['q'],
        );
      }
      elseif ($node->og_selective == OG_OPEN) {
        return array(
          'title' => t('Join this group'),
          'href' => "og/subscribe/" . $node->nid,
          'query' => 'destination=' . $_GET['q'],
        );
      }
    }
  }
  return;
  */
}