button on the group page to post a new message

This commit is contained in:
Evan Prodromou 2011-02-07 11:51:38 -05:00
parent 5db1479a95
commit 951df6b02f
2 changed files with 39 additions and 0 deletions

View File

@ -345,6 +345,39 @@ class PrivateGroupPlugin extends Plugin
return true;
}
/**
* To add a "Message" button to the group profile page
*
* @param Action $action The showgroup action being shown
* @param User_group $group The current group
*
* @return boolean hook value
*/
function onEndGroupActionsList($action, $group)
{
$cur = common_current_user();
if (empty($cur)) {
return true;
}
try {
Group_privacy_settings::ensurePost($cur, $group);
} catch (Exception $e) {
return true;
}
$action->elementStart('li', 'entity_send-a-message');
$action->element('a', array('href' => common_local_url('newgroupmessage', array('nickname' => $group->nickname)),
'title' => _('Send a direct message to this group')),
_('Message'));
// $form = new GroupMessageForm($action, $group);
// $form->hidden = true;
// $form->show();
$action->elementEnd('li');
return true;
}
function onPluginVersion(&$versions)
{
$versions[] = array('name' => 'PrivateGroup',

View File

@ -127,6 +127,12 @@ class NewgroupmessageAction extends Action
}
}
function showNoticeForm()
{
$form = new GroupMessageForm($this, $this->group);
$form->show();
}
function sendNewMessage()
{
$gm = Group_message::send($this->user, $this->group, $this->text);