aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/group.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-18 18:23:50 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-18 18:23:50 +0000
commit361bff59658e6119b76e7ff31cd67c6054c93c8f (patch)
tree115c0eb308aa1312f7e69b52506eb625a2887c0d /engine/lib/group.php
parent0c997a2fe195542c1cdec5b828cea87d0992dc78 (diff)
downloadelgg-361bff59658e6119b76e7ff31cd67c6054c93c8f.tar.gz
elgg-361bff59658e6119b76e7ff31cd67c6054c93c8f.tar.bz2
Moved container_guid to entities, modified a bunch of functions.
git-svn-id: https://code.elgg.org/elgg/trunk@1473 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/group.php')
-rw-r--r--engine/lib/group.php45
1 files changed, 38 insertions, 7 deletions
diff --git a/engine/lib/group.php b/engine/lib/group.php
index b0c6d3346..90ee650f3 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -146,6 +146,34 @@
{
return get_group_members($this->getGUID(), $limit, $offset, 0 , $count);
}
+
+ /**
+ * For compatibility with ElggUser
+ */
+ public function getFriends($subtype = "", $limit = 10, $offset = 0) {
+ return get_group_members($this->getGUID(), $limit, $offset);
+ }
+
+ /**
+ * For compatibility with ElggUser
+ */
+ public function getFriendsOf($subtype = "", $limit = 10, $offset = 0) {
+ return get_group_members($this->getGUID(), $limit, $offset);
+ }
+
+ /**
+ * For compatibility with ElggUser
+ */
+ public function isFriend() {
+ return $this->isMember();
+ }
+
+ /**
+ * For compatibility with ElggUser
+ */
+ public function isFriendOf() {
+ return $this->isMember();
+ }
/**
* Returns whether the current group is public membership or not.
@@ -165,8 +193,9 @@
* @param ElggUser $user The user
* @return bool
*/
- public function isMember(ElggUser $user)
- {
+ public function isMember($user = 0)
+ {
+ if ($user == 0) $user = $_SESSION['user'];
return is_group_member($this->getGUID(), $user->getGUID());
}
@@ -266,8 +295,9 @@
if (($container) && ($user))
{
- // Basics, see if the user is a member of the group.
- if (!$container->isMember($user)) return false;
+ // Basics, see if the user is a member of the group.
+ if ($container instanceof ElggGroup)
+ if (!$container->isMember($user)) return false;
// See if anyone else has anything to say
return trigger_plugin_hook('group_permissions_check',$entity->type,array('container' => $container, 'user' => $user), false);
@@ -358,6 +388,7 @@
return false;
}
+
/**
* Delete a group's extra data.
@@ -490,7 +521,7 @@
$where[] = "e.site_guid = {$site_guid}";
if ($container_guid > 0)
- $where[] = "o.container_guid = {$container_guid}";
+ $where[] = "e.container_guid = {$container_guid}";
if (!$count) {
$query = "SELECT * from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}objects_entity o on e.guid=o.guid where ";
@@ -569,7 +600,7 @@
if ($site_guid > 0)
$where[] = "e.site_guid = {$site_guid}";
if ($container_guid > 0)
- $where[] = "o.container_guid = {$container_guid}";
+ $where[] = "e.container_guid = {$container_guid}";
if (is_array($owner_guid)) {
$where[] = "e.owner_guid in (".implode(",",$owner_guid).")";
} else if ($owner_guid > 0)
@@ -656,7 +687,7 @@
if ($owner_guid > 0)
$where[] = "e.owner_guid = {$owner_guid}";
if ($container_guid > 0)
- $where[] = "o.container_guid = {$container_guid}";
+ $where[] = "e.container_guid = {$container_guid}";
if ($count) {
$query = "SELECT count(e.guid) as total ";