]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Page created and link added in menu.
authorSem <sembrestels@riseup.net>
Thu, 8 Dec 2011 15:33:51 +0000 (16:33 +0100)
committerSem <sembrestels@riseup.net>
Thu, 8 Dec 2011 15:33:51 +0000 (16:33 +0100)
languages/en.php [new file with mode: 0644]
manifest.xml [new file with mode: 0644]
start.php [new file with mode: 0644]

diff --git a/languages/en.php b/languages/en.php
new file mode 100644 (file)
index 0000000..346ea06
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+/**
+ * ElggFriendRequest English language file.
+ *
+ */
+
+$english = array(
+       'friendrequest' => 'Friend Requests',
+);
+
+add_translation('en', $english);
diff --git a/manifest.xml b/manifest.xml
new file mode 100644 (file)
index 0000000..8bc2d9c
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+       <name>Friend request</name>
+       <author>Bosssumon and Zac Hopkinson, Lorea</author>
+       <version>1.8</version>
+       <category>bundled</category>
+       <category>social</category>
+       <description>Let users confirm friend requests. Make all friend requests reciprocal</description>
+       <website>https://lorea.cc/</website>
+       <copyright>(C) Lorea 2011</copyright>
+       <license>GNU General Public License version 2</license>
+       <requires>
+               <type>elgg_release</type>
+               <version>1.8</version>
+       </requires>
+       <activate_on_install>true</activate_on_install>
+</plugin_manifest>
diff --git a/start.php b/start.php
new file mode 100644 (file)
index 0000000..744a3ef
--- /dev/null
+++ b/start.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Elgg friend request plugin.
+ *
+ * @package ElggFriendRequest
+ */
+
+elgg_register_event_handler('init', 'system', 'friendrequest_init');
+
+function friendrequest_init() {
+       
+       //This will let users view their friend requests
+       elgg_register_page_handler('friendrequests', 'friendrequest_page_handler');
+       
+       if (elgg_is_logged_in()) {
+               $params = array(
+                               'name' => 'friendrequests',
+                               'text' => elgg_echo('friendrequest'),
+                               'href' => "friendrequests",
+                               'contexts' => array('friends'),
+               );
+               elgg_register_menu_item('page', $params);
+       }
+       
+       $actions_dir = elgg_get_plugins_path().'friendrequest/actions/friendrequest';
+       elgg_register_action('friendrequest/approve', "$actions_dir/approve.php");
+       elgg_register_action('friendrequest/decline', "$actions_dir/decline.php");
+       
+       //We need to override the friend remove action to remove the relationship we created
+       elgg_register_action('friends/remove', "$actions_dir/removefriend.php");
+       
+       //Regular Elgg engine sends out an email via an event. The 400 priority will let us run first.
+       //Then we return false to stop the event chain. The normal event handler will never get to run.
+       //elgg_register_event_handler('create', 'friend', 'friendrequest_event_create_friend', 400);
+       
+       //Handle our add action event:
+       //elgg_register_event_handler('create', 'friendrequest', 'friendrequest_event_create_friendrequest');
+       
+}
+
+function friendrequest_page_handler($page){
+       
+       //Keep the URLs uniform:
+       if (isset($page[0])) {
+               forward("friendrequests");
+       }
+       
+       elgg_push_context('friends');
+       
+       $params = array(
+               'title' => elgg_echo('friendrequest'),
+               'filter' => '',
+       );
+       
+       $body = elgg_view_layout('content', $params);
+
+       echo elgg_view_page($params['title'], $body);
+       return true;
+}
+
+function friendrequest_event_create_friend(){
+       
+}
+
+function friendrequest_event_create_friendrequest(){
+       
+}