]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #1540: Added site_guid to get_user_access_collections().
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 26 Feb 2010 20:31:15 +0000 (20:31 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 26 Feb 2010 20:31:15 +0000 (20:31 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3975 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/access.php

index a626bae7ecc6fc3f62da20cbcb820180562ee2c0..fa9510d7a87fadbfcae5180991519daf7107d7f1 100644 (file)
@@ -600,13 +600,23 @@ function remove_user_from_access_collection($user_guid, $collection_id) {
  * Get all of a users collections
  *
  * @param int $owner_guid The user ID
+ * @param int $site_guid The GUID of the site (default: current site).
  * @return true|false Depending on success
  */
-function get_user_access_collections($owner_guid) {
+function get_user_access_collections($owner_guid, $site_guid = 0) {
        global $CONFIG;
        $owner_guid = (int) $owner_guid;
+       $site_guid = (int) $site_guid;
+
+       if (($site_guid == 0) && (isset($CONFIG->site_guid))) {
+               $site_guid = $CONFIG->site_guid;
+       }
+
+       $query = "SELECT * FROM {$CONFIG->dbprefix}access_collections
+                       WHERE owner_guid = {$owner_guid}
+                       AND site_guid = {$site_guid}";
 
-       $collections = get_data("SELECT * FROM {$CONFIG->dbprefix}access_collections WHERE owner_guid = {$owner_guid}");
+       $collections = get_data($query);
 
        return $collections;
 }