aboutsummaryrefslogtreecommitdiff
path: root/actions/friends/collections/add.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/friends/collections/add.php')
-rw-r--r--actions/friends/collections/add.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/actions/friends/collections/add.php b/actions/friends/collections/add.php
new file mode 100644
index 000000000..e63a149f7
--- /dev/null
+++ b/actions/friends/collections/add.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Elgg collection add page
+ *
+ * @package Elgg.Core
+ * @subpackage Friends.Collections
+ */
+
+$collection_name = htmlspecialchars(get_input('collection_name', '', false), ENT_QUOTES, 'UTF-8');
+$friends = get_input('friends_collection');
+
+if (!$collection_name) {
+ register_error(elgg_echo("friends:nocollectionname"));
+ forward(REFERER);
+}
+
+$id = create_access_collection($collection_name);
+
+if ($id) {
+ $result = update_access_collection($id, $friends);
+ if ($result) {
+ system_message(elgg_echo("friends:collectionadded"));
+ forward("collections/" . elgg_get_logged_in_user_entity()->username);
+ } else {
+ register_error(elgg_echo("friends:nocollectionname"));
+ forward(REFERER);
+ }
+} else {
+ register_error(elgg_echo("friends:nocollectionname"));
+ forward(REFERER);
+} \ No newline at end of file