aboutsummaryrefslogtreecommitdiff
path: root/actions/notifications/settings/usersettings/save.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-24 17:14:59 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-24 17:14:59 +0000
commitee18a9dc58e75113b3377d08f460788dde419869 (patch)
tree166497cedeae1f0a355241c4c28054e4e1e29b0f /actions/notifications/settings/usersettings/save.php
parent3e5f7cf353e44de8d4d22c19f3c904b0a16401a8 (diff)
downloadelgg-ee18a9dc58e75113b3377d08f460788dde419869.tar.gz
elgg-ee18a9dc58e75113b3377d08f460788dde419869.tar.bz2
Closes #83 - API & Interface for selecting notification methods
git-svn-id: https://code.elgg.org/elgg/trunk@1110 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions/notifications/settings/usersettings/save.php')
-rw-r--r--actions/notifications/settings/usersettings/save.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/actions/notifications/settings/usersettings/save.php b/actions/notifications/settings/usersettings/save.php
new file mode 100644
index 000000000..79970421a
--- /dev/null
+++ b/actions/notifications/settings/usersettings/save.php
@@ -0,0 +1,37 @@
+<?php
+ /**
+ * Elgg notifications user preference save acion.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ // Method
+ $method = get_input('method');
+ gatekeeper();
+
+ $result = false;
+ foreach ($method as $k => $v)
+ {
+ $result = set_user_notification_setting($_SESSION['user']->guid, $k, ($v == 'yes') ? true : false);
+
+ if (!$result)
+ {
+ system_message(elgg_echo('notifications:usersettings:save:fail'));
+ forward($_SERVER['HTTP_REFERER']);
+
+ exit;
+ }
+ }
+
+ if ($result)
+ system_message(elgg_echo('notifications:usersettings:save:ok'));
+ else
+ system_message(elgg_echo('notifications:usersettings:save:fail'));
+
+ forward($_SERVER['HTTP_REFERER']);
+?> \ No newline at end of file