aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-31 15:22:48 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-31 15:22:48 +0000
commitab7d70b9d870d69a5b79c3fbb005565302112efc (patch)
tree3e1b7ed7925885fe4780c249a4008f9bd3f5cea9 /engine/lib
parent2ba7cd11ba933888f137f875006766122fa6e0b0 (diff)
downloadelgg-ab7d70b9d870d69a5b79c3fbb005565302112efc.tar.gz
elgg-ab7d70b9d870d69a5b79c3fbb005565302112efc.tar.bz2
Picker saves correctly!
git-svn-id: https://code.elgg.org/elgg/trunk@1635 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/access.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index 2c9a886e6..a1741f8bf 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -202,6 +202,33 @@
}
/**
+ * Updates the membership in an access collection.
+ *
+ * @param int $collection_id The ID of the collection.
+ * @param array $members Array of member GUIDs
+ * @return true|false Depending on success
+ */
+ function update_access_collection($collection_id, $members) {
+
+ global $CONFIG;
+ $collection_id = (int) $collection_id;
+
+ if ($collection = get_access_collection($collection_id)) {
+ delete_data("delete from {$CONFIG->dbprefix}access_collection_membership where access_collection_id = {$collection_id}");
+ }
+
+ if (is_array($members) && sizeof($members) > 0) {
+ foreach($members as $member) {
+ $member = (int) $member;
+ add_user_to_access_collection($member, $collection_id);
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
* Deletes a specified access collection
*
* @param int $collection_id The collection ID
@@ -232,7 +259,7 @@
$collection_id = (int) $collection_id;
global $CONFIG;
- $get_collection = get_data("SELECT * FROM {$CONFIG->dbprefix}access_collections WHERE id = {$collection_id}");
+ $get_collection = get_data_row("SELECT * FROM {$CONFIG->dbprefix}access_collections WHERE id = {$collection_id}");
return $get_collection;
@@ -252,7 +279,7 @@
$collections = get_write_access_array();
if (array_key_exists($collection_id, $collections) && $user = get_user($user_guid)) {
-
+
global $CONFIG;
insert_data("insert into {$CONFIG->dbprefix}access_collection_membership set access_collection_id = {$collection_id}, user_guid = {$user_guid}");
return true;