From: Evan Prodromou Date: Mon, 7 Feb 2011 16:51:38 +0000 (-0500) Subject: button on the group page to post a new message X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=951df6b02f1dcb51ae173d3ee5b822edc1e1661c;p=quix0rs-gnu-social.git button on the group page to post a new message --- diff --git a/plugins/PrivateGroup/PrivateGroupPlugin.php b/plugins/PrivateGroup/PrivateGroupPlugin.php index 001f085c0d..6ead6965ec 100644 --- a/plugins/PrivateGroup/PrivateGroupPlugin.php +++ b/plugins/PrivateGroup/PrivateGroupPlugin.php @@ -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', diff --git a/plugins/PrivateGroup/newgroupmessage.php b/plugins/PrivateGroup/newgroupmessage.php index c2755596b5..a2c5dfdbdb 100644 --- a/plugins/PrivateGroup/newgroupmessage.php +++ b/plugins/PrivateGroup/newgroupmessage.php @@ -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);