aboutsummaryrefslogtreecommitdiff
path: root/mod/notifications/actions
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-23 15:22:20 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-23 15:22:20 +0000
commit0dbe6c895303966cb3397221b0aed396553ee3be (patch)
treedec7484c2776cb72b6225bcae54f5ef7f36f3577 /mod/notifications/actions
parent52a6050d1b4a7fae752019570bf2af521f4e2f6c (diff)
downloadelgg-0dbe6c895303966cb3397221b0aed396553ee3be.tar.gz
elgg-0dbe6c895303966cb3397221b0aed396553ee3be.tar.bz2
Added save action for the notification subscriptions.
git-svn-id: https://code.elgg.org/elgg/trunk@2609 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/notifications/actions')
-rw-r--r--mod/notifications/actions/save.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/mod/notifications/actions/save.php b/mod/notifications/actions/save.php
new file mode 100644
index 000000000..faee22ef6
--- /dev/null
+++ b/mod/notifications/actions/save.php
@@ -0,0 +1,34 @@
+<?php
+
+ /**
+ * Elgg notifications plugin save action
+ *
+ * @package ElggNotifications
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+ // Restrict to logged in users
+ gatekeeper();
+
+ // Get people
+ $subscriptions = get_input('subscriptions');
+
+ // Clear existing subscriptions
+ global $SESSION;
+ remove_entity_relationships($SESSION['user']->guid,'notify',false);
+
+ // Add new ones
+ if (is_array($subscriptions) && !empty($subscriptions)) {
+ foreach($subscriptions as $subscription) {
+ register_notification_interest($SESSION['user']->guid, $subscription);
+ }
+ }
+
+ system_message(elgg_echo('notifications:subscriptions:success'));
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?> \ No newline at end of file