aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/actions/groups/edit.php30
-rw-r--r--mod/groups/lib/groups.php6
-rw-r--r--mod/groups/start.php6
-rw-r--r--mod/groups/views/default/forms/groups/edit.php13
-rw-r--r--mod/groups/views/default/groups/css.php4
-rw-r--r--mod/groups/views/default/groups/profile/summary.php9
-rw-r--r--mod/groups/views/default/groups/sidebar/featured.php2
-rw-r--r--mod/groups/views/default/groups/sidebar/members.php2
-rw-r--r--mod/groups/views/default/groups/sidebar/my_status.php2
9 files changed, 58 insertions, 16 deletions
diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php
index d0689be2e..f19b90566 100644
--- a/mod/groups/actions/groups/edit.php
+++ b/mod/groups/actions/groups/edit.php
@@ -54,6 +54,20 @@ if ($group_guid && !$group->canEdit()) {
// Assume we can edit or this is a new group
if (sizeof($input) > 0) {
foreach($input as $shortname => $value) {
+ // update access collection name if group name changes
+ if (!$is_new_group && $shortname == 'name' && $value != $group->name) {
+ $group_name = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
+ $ac_name = sanitize_string(elgg_echo('groups:group') . ": " . $group_name);
+ $acl = get_access_collection($group->group_acl);
+ if ($acl) {
+ // @todo Elgg api does not support updating access collection name
+ $db_prefix = elgg_get_config('dbprefix');
+ $query = "UPDATE {$db_prefix}access_collections SET name = '$ac_name'
+ WHERE id = $group->group_acl";
+ update_data($query);
+ }
+ }
+
$group->$shortname = $value;
}
}
@@ -92,7 +106,21 @@ if (!$is_new_group && $new_owner_guid && $new_owner_guid != $old_owner_guid) {
// verify new owner is member and old owner/admin is logged in
if (is_group_member($group_guid, $new_owner_guid) && ($old_owner_guid == $user->guid || $user->isAdmin())) {
$group->owner_guid = $new_owner_guid;
-
+ $group->container_guid = $new_owner_guid;
+
+ $metadata = elgg_get_metadata(array(
+ 'guid' => $group_guid,
+ 'limit' => false,
+ ));
+ if ($metadata) {
+ foreach ($metadata as $md) {
+ if ($md->owner_guid == $old_owner_guid) {
+ $md->owner_guid = $new_owner_guid;
+ $md->save();
+ }
+ }
+ }
+
// @todo Remove this when #4683 fixed
$owner_has_changed = true;
$old_icontime = $group->icontime;
diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php
index d8d0f568d..0557d41eb 100644
--- a/mod/groups/lib/groups.php
+++ b/mod/groups/lib/groups.php
@@ -79,7 +79,7 @@ function groups_search_page() {
$params = array(
'metadata_name' => 'interests',
'metadata_value' => $tag,
- 'types' => 'group',
+ 'type' => 'group',
'full_view' => FALSE,
);
$content = elgg_list_entities_from_metadata($params);
@@ -370,7 +370,7 @@ function groups_handle_members_page($guid) {
'relationship' => 'member',
'relationship_guid' => $group->guid,
'inverse_relationship' => true,
- 'types' => 'user',
+ 'type' => 'user',
'limit' => 20,
));
@@ -561,6 +561,8 @@ function groups_prepare_form_vars($group = null) {
if ($group->access_id != ACCESS_PUBLIC && $group->access_id != ACCESS_LOGGED_IN) {
// group only access - this is done to handle access not created when group is created
$values['vis'] = ACCESS_PRIVATE;
+ } else {
+ $values['vis'] = $group->access_id;
}
$values['entity'] = $group;
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 4e49d9e55..46ab0e636 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -148,7 +148,7 @@ function groups_setup_sidebar_menus() {
$count = elgg_get_entities_from_relationship(array(
'type' => 'user',
'relationship' => 'membership_request',
- 'relationship_guid' => $guid,
+ 'relationship_guid' => $page_owner->getGUID(),
'inverse_relationship' => true,
'count' => true,
));
@@ -572,7 +572,7 @@ function groups_write_acl_plugin_hook($hook, $entity_type, $returnvalue, $params
'relationship' => 'member',
'relationship_guid' => $user_guid,
'inverse_relationship' => FALSE,
- 'limit' => 999
+ 'limit' => false
));
if ($groups) {
@@ -1013,7 +1013,7 @@ function discussion_reply_notifications($event, $type, $annotation) {
'relationship' => 'notify' . $method,
'relationship_guid' => $topic->getContainerGUID(),
'inverse_relationship' => true,
- 'types' => 'user',
+ 'type' => 'user',
'limit' => 0,
));
diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php
index 41d97e6c3..e2dc5455a 100644
--- a/mod/groups/views/default/forms/groups/edit.php
+++ b/mod/groups/views/default/forms/groups/edit.php
@@ -91,9 +91,18 @@ if (isset($vars['entity'])) {
}
if ($entity && ($owner_guid == elgg_get_logged_in_user_guid() || elgg_is_admin_logged_in())) {
- $owner_guid = $vars['entity']->owner_guid;
$members = array();
- foreach ($vars['entity']->getMembers(0) as $member) {
+
+ $options = array(
+ 'relationship' => 'member',
+ 'relationship_guid' => $vars['entity']->getGUID(),
+ 'inverse_relationship' => true,
+ 'type' => 'user',
+ 'limit' => 0,
+ );
+
+ $batch = new ElggBatch('elgg_get_entities_from_relationship', $options);
+ foreach ($batch as $member) {
$members[$member->guid] = "$member->name (@$member->username)";
}
?>
diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php
index 6f710ddab..32dd2b74d 100644
--- a/mod/groups/views/default/groups/css.php
+++ b/mod/groups/views/default/groups/css.php
@@ -9,10 +9,6 @@
.groups-profile > .elgg-image {
margin-right: 10px;
}
-.groups-profile img {
- width: 100%;
- height: auto;
-}
.groups-stats {
background: #eeeeee;
padding: 5px;
diff --git a/mod/groups/views/default/groups/profile/summary.php b/mod/groups/views/default/groups/profile/summary.php
index f1221f19a..3f7496871 100644
--- a/mod/groups/views/default/groups/profile/summary.php
+++ b/mod/groups/views/default/groups/profile/summary.php
@@ -25,7 +25,14 @@ if (!$owner) {
<div class="groups-profile clearfix elgg-image-block">
<div class="elgg-image">
<div class="groups-profile-icon">
- <?php echo elgg_view_entity_icon($group, 'large', array('href' => '')); ?>
+ <?php
+ // we don't force icons to be square so don't set width/height
+ echo elgg_view_entity_icon($group, 'large', array(
+ 'href' => '',
+ 'width' => '',
+ 'height' => '',
+ ));
+ ?>
</div>
<div class="groups-stats">
<p>
diff --git a/mod/groups/views/default/groups/sidebar/featured.php b/mod/groups/views/default/groups/sidebar/featured.php
index 8bd51ab5c..f3f8f8d2d 100644
--- a/mod/groups/views/default/groups/sidebar/featured.php
+++ b/mod/groups/views/default/groups/sidebar/featured.php
@@ -8,7 +8,7 @@
$featured_groups = elgg_get_entities_from_metadata(array(
'metadata_name' => 'featured_group',
'metadata_value' => 'yes',
- 'types' => 'group',
+ 'type' => 'group',
'limit' => 10,
));
diff --git a/mod/groups/views/default/groups/sidebar/members.php b/mod/groups/views/default/groups/sidebar/members.php
index 11273d0e6..1199a0c34 100644
--- a/mod/groups/views/default/groups/sidebar/members.php
+++ b/mod/groups/views/default/groups/sidebar/members.php
@@ -20,7 +20,7 @@ $body = elgg_list_entities_from_relationship(array(
'relationship' => 'member',
'relationship_guid' => $vars['entity']->guid,
'inverse_relationship' => true,
- 'types' => 'user',
+ 'type' => 'user',
'limit' => $limit,
'list_type' => 'gallery',
'gallery_class' => 'elgg-gallery-users',
diff --git a/mod/groups/views/default/groups/sidebar/my_status.php b/mod/groups/views/default/groups/sidebar/my_status.php
index 4c36c0213..5951cbd28 100644
--- a/mod/groups/views/default/groups/sidebar/my_status.php
+++ b/mod/groups/views/default/groups/sidebar/my_status.php
@@ -14,7 +14,7 @@ $subscribed = elgg_extract('subscribed', $vars);
if (!elgg_is_logged_in()) {
return true;
}
-$t = new ElggMenuItem();
+
// membership status
$is_member = $group->isMember($user);
$is_owner = $group->getOwnerEntity() == $user;