function og_block_details in Organic groups 6
Same name and namespace in other branches
- 5.8 og.module \og_block_details()
- 5 og.module \og_block_details()
- 5.2 og.module \og_block_details()
- 5.3 og.module \og_block_details()
- 5.7 og.module \og_block_details()
- 6.2 og.module \og_block_details()
1 call to og_block_details()
- og_block in ./
og.module - Implementation of hook_block().
File
- ./
og.module, line 2499
Code
function og_block_details() {
global $user;
// Only display group details if we have a group context.
if (($node = og_get_group_context()) && node_access('view', $node)) {
list($txt, $subscription) = og_subscriber_count_link($node);
if ($subscription == 'active' || user_access('administer nodes')) {
$links = module_invoke_all('og_create_links', $node);
// We want to open this up for OG_INVITE_ONLY but we need to handle invitation workflow much better. See http://drupal.org/node/170332
if ($node->og_selective < OG_INVITE_ONLY) {
$links['invite'] = l(t('Invite friend'), "og/invite/{$node->nid}");
}
$links['subscribers'] = $txt;
$links['manager'] = t('Manager: !name', array(
'!name' => theme('username', $node),
));
// Site admins get a Join link if they are not yet subscribed.
$subscribe = isset($subscription) && og_is_group_member($node->nid, FALSE) ? l(t('My membership'), "og/manage/{$node->nid}") : og_subscribe_link($node);
if (isset($subscribe)) {
$links['my_membership'] = $subscribe;
}
}
elseif ($subscription == 'requested') {
$links['approval'] = t('Your membership request awaits approval.');
$links['delete'] = l(t('Delete request'), "og/unsubscribe/{$node->nid}/{$user->uid}", array(
'query' => 'destination=og',
));
}
elseif (!$user->uid) {
$dest = drupal_get_destination();
$links['must_login'] = t('You must <a href="!register">register</a>/<a href="!login">login</a> in order to post into this group.', array(
'!register' => url("user/register", array(
'query' => $dest,
)),
'!login' => url("user/login", array(
'query' => $dest,
)),
));
}
elseif ($node->og_selective < OG_INVITE_ONLY) {
$links['subscribe'] = og_subscribe_link($node);
}
elseif ($node->og_selective == OG_INVITE_ONLY) {
$links['closed'] = t('This is an <em>invite only</em> group. The group administrators add/remove members as needed.');
}
elseif ($node->og_selective == OG_CLOSED) {
$links['closed'] = t('This is a <em>closed</em> group. The group administrators add/remove members as needed.');
}
// Modify these links by reference. If you want control of the whole block, see og_block_details().
drupal_alter('og_links', $links, $node);
$block['content'] = theme('item_list', $links);
$block['subject'] = l($node->title, "node/{$node->nid}");
return $block;
}
}