]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
button on the group page to post a new message
authorEvan Prodromou <evan@status.net>
Mon, 7 Feb 2011 16:51:38 +0000 (11:51 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 7 Feb 2011 16:51:38 +0000 (11:51 -0500)
plugins/PrivateGroup/PrivateGroupPlugin.php
plugins/PrivateGroup/newgroupmessage.php

index 001f085c0de3a68b5674cb64e1c4cb46e8733045..6ead6965ec38f9a2875223fa7e82c53d1e091c92 100644 (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',
index c2755596b51d4ec83047579bd40f6663e2cad39e..a2c5dfdbdbee6ddbab531f67e047c4c44a83396d 100644 (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);