button on the group page to post a new message
This commit is contained in:
parent
5db1479a95
commit
951df6b02f
@ -345,6 +345,39 @@ class PrivateGroupPlugin extends Plugin
|
|||||||
return true;
|
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)
|
function onPluginVersion(&$versions)
|
||||||
{
|
{
|
||||||
$versions[] = array('name' => 'PrivateGroup',
|
$versions[] = array('name' => 'PrivateGroup',
|
||||||
|
@ -127,6 +127,12 @@ class NewgroupmessageAction extends Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showNoticeForm()
|
||||||
|
{
|
||||||
|
$form = new GroupMessageForm($this, $this->group);
|
||||||
|
$form->show();
|
||||||
|
}
|
||||||
|
|
||||||
function sendNewMessage()
|
function sendNewMessage()
|
||||||
{
|
{
|
||||||
$gm = Group_message::send($this->user, $this->group, $this->text);
|
$gm = Group_message::send($this->user, $this->group, $this->text);
|
||||||
|
Loading…
Reference in New Issue
Block a user