function spaces_og_subscription_link in Spaces 6
Same name and namespace in other branches
- 5.2 spaces_og.module \spaces_og_subscription_link()
- 5 spaces.module \spaces_og_subscription_link()
- 6.3 spaces_og/spaces_og.module \spaces_og_subscription_link()
- 6.2 spaces_og/spaces_og.module \spaces_og_subscription_link()
- 7.3 spaces_og/spaces_og.module \spaces_og_subscription_link()
- 7 spaces_og/spaces_og.module \spaces_og_subscription_link()
Custom subscription link - use "join" instead of "subscribe" - make it shorter.
1 call to spaces_og_subscription_link()
- spaces_og.module in spaces_og/
spaces_og.module
File
- spaces_og/
spaces_og.module, line 822
Code
function spaces_og_subscription_link() {
global $user;
if ($user->uid && is_array($user->og_groups) && ($space = spaces_get_space())) {
$gid = $space->sid;
$node = node_load($gid);
// User is a member
if ($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)) {
return array(
'title' => t('Leave this group'),
'href' => "og/unsubscribe/" . $node->nid,
'query' => 'destination=' . $_GET['q'],
);
}
}
else {
if (db_result(db_query("SELECT count(nid) FROM {og_uid} WHERE nid = %d AND uid = %d AND is_active = 0", $gid, $user->uid))) {
return array(
'title' => t('Cancel request to join'),
'href' => "og/unsubscribe/" . $node->nid,
'query' => 'destination=' . $_GET['q'],
);
}
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;
}