commons_shoutbox.module in Drupal Commons 6.2
File
modules/features/commons_shoutbox/commons_shoutbox.module
View source
<?php
include_once 'commons_shoutbox.features.inc';
function commons_shoutbox_og_features_registry() {
$registry = array();
$feature = new stdClass();
$feature->id = 'commons_shoutbox';
$feature->name = t('Shoutbox');
$feature->description = t('Enable your users to post short messages to each other without creating a complete new page, and see (almost) live updates from other users.');
$feature->components = array(
'path' => array(
'node/%node/shoutbox',
'shoutbox/group/%node',
'shoutbox/group/%node/js/view',
),
'context' => array(
'group-home-shoutbox',
),
'og link' => array(
'shoutbox',
),
);
$registry[$feature->id] = $feature;
return $registry;
}
function commons_shoutbox_menu_alter(&$items) {
$items['node/%node/shoutbox'] = $items['shoutbox/group/%node'];
$items['node/%node/shoutbox']['page arguments'] = array(
1,
);
$items['node/%node/shoutbox']['access arguments'] = array(
'view',
1,
);
unset($items['shoutbox/group/%node']);
}
function commons_shoutbox_og_links_alter(&$links) {
unset($links['shoutbox']);
}
function commons_shoutbox_shoutbox($op, &$shout, &$a1 = NULL, $form_state = NULL) {
switch ($op) {
case 'link':
if ($group = og_get_group_context()) {
$a1 = "node/{$group->nid}/shoutbox";
}
break;
}
}