aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/actions/groups/delete.php7
-rw-r--r--mod/groups/actions/groups/membership/remove.php31
-rw-r--r--mod/groups/languages/en.php3
-rw-r--r--mod/groups/manifest.xml2
-rw-r--r--mod/groups/start.php44
-rw-r--r--mod/groups/views/default/forms/groups/delete.php17
-rw-r--r--mod/groups/views/default/forms/groups/edit.php12
-rw-r--r--mod/groups/views/default/forms/groups/invite.php2
-rw-r--r--mod/groups/views/default/group/default.php2
-rw-r--r--mod/groups/views/default/groups/css.php4
-rw-r--r--mod/groups/views/default/groups/edit.php6
-rw-r--r--mod/groups/views/default/groups/profile/fields.php4
-rw-r--r--mod/groups/views/default/object/groupforumtopic.php4
13 files changed, 107 insertions, 31 deletions
diff --git a/mod/groups/actions/groups/delete.php b/mod/groups/actions/groups/delete.php
index 932d03355..2ff6c339c 100644
--- a/mod/groups/actions/groups/delete.php
+++ b/mod/groups/actions/groups/delete.php
@@ -3,7 +3,12 @@
* Delete a group
*/
-$guid = (int) get_input('group_guid');
+$guid = (int) get_input('guid');
+if (!$guid) {
+ // backward compatible
+ elgg_deprecated_notice("Use 'guid' for group delete action", 1.8);
+ $guid = (int)get_input('group_guid');
+}
$entity = get_entity($guid);
if (!$entity->canEdit()) {
diff --git a/mod/groups/actions/groups/membership/remove.php b/mod/groups/actions/groups/membership/remove.php
new file mode 100644
index 000000000..650d35286
--- /dev/null
+++ b/mod/groups/actions/groups/membership/remove.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Remove a user from a group
+ *
+ * @package ElggGroups
+ */
+
+$user_guid = get_input('user_guid');
+$group_guid = get_input('group_guid');
+
+$user = get_entity($user_guid);
+$group = get_entity($group_guid);
+
+elgg_set_page_owner_guid($group->guid);
+
+if (($user instanceof ElggUser) && ($group instanceof ElggGroup) && $group->canEdit()) {
+ // Don't allow removing group owner
+ if ($group->getOwnerGUID() != $user->getGUID()) {
+ if ($group->leave($user)) {
+ system_message(elgg_echo("groups:removed", array($user->name)));
+ } else {
+ register_error(elgg_echo("groups:cantremove"));
+ }
+ } else {
+ register_error(elgg_echo("groups:cantremove"));
+ }
+} else {
+ register_error(elgg_echo("groups:cantremove"));
+}
+
+forward(REFERER);
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index 63a6df3a9..f2895db88 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -166,6 +166,9 @@ $english = array(
'groups:notitle' => 'Groups must have a title',
'groups:cantjoin' => 'Can not join group',
'groups:cantleave' => 'Could not leave group',
+ 'groups:removeuser' => 'Remove from group',
+ 'groups:cantremove' => 'Cannot remove user from group',
+ 'groups:removed' => 'Successfully removed %s from group',
'groups:addedtogroup' => 'Successfully added the user to the group',
'groups:joinrequestnotmade' => 'Could not request to join group',
'groups:joinrequestmade' => 'Requested to join group',
diff --git a/mod/groups/manifest.xml b/mod/groups/manifest.xml
index 32671397d..4188aa861 100644
--- a/mod/groups/manifest.xml
+++ b/mod/groups/manifest.xml
@@ -4,6 +4,8 @@
<author>Core developers</author>
<version>1.8</version>
<category>bundled</category>
+ <category>social</category>
+ <category>widget</category>
<description>Provides group support for elgg</description>
<website>http://www.elgg.org/</website>
<copyright>See COPYRIGHT.txt</copyright>
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 9de7f1cc1..9a375e89d 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -44,6 +44,7 @@ function groups_init() {
elgg_register_action("groups/invite", "$action_base/invite.php");
elgg_register_action("groups/join", "$action_base/join.php");
elgg_register_action("groups/leave", "$action_base/leave.php");
+ elgg_register_action("groups/remove", "$action_base/remove.php");
elgg_register_action("groups/killrequest", "$action_base/delete_request.php");
elgg_register_action("groups/killinvitation", "$action_base/delete_invite.php");
elgg_register_action("groups/addtogroup", "$action_base/add.php");
@@ -60,6 +61,9 @@ function groups_init() {
// group entity menu
elgg_register_plugin_hook_handler('register', 'menu:entity', 'groups_entity_menu_setup');
+
+ // group user hover menu
+ elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'groups_user_entity_menu_setup');
//extend some views
elgg_extend_view('css/elgg', 'groups/css');
@@ -367,6 +371,44 @@ function groups_entity_menu_setup($hook, $type, $return, $params) {
}
/**
+ * Add a remove user link to user hover menu when the page owner is a group
+ */
+function groups_user_entity_menu_setup($hook, $type, $return, $params) {
+ if (elgg_is_logged_in()) {
+ $group = elgg_get_page_owner_entity();
+
+ // Check for valid group
+ if (!elgg_instanceof($group, 'group')) {
+ return $return;
+ }
+
+ $entity = $params['entity'];
+
+ // Make sure we have a user and that user is a member of the group
+ if (!elgg_instanceof($entity, 'user') || !$group->isMember($entity)) {
+ return $return;
+ }
+
+ // Add remove link if we can edit the group, and if we're not trying to remove the group owner
+ if ($group->canEdit() && $group->getOwnerGUID() != $entity->guid) {
+ $remove = elgg_view('output/confirmlink', array(
+ 'href' => "action/groups/remove?user_guid={$entity->guid}&group_guid={$group->guid}",
+ 'text' => elgg_echo('groups:removeuser'),
+ ));
+
+ $options = array(
+ 'name' => 'removeuser',
+ 'text' => $remove,
+ 'priority' => 999,
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
+ }
+
+ return $return;
+}
+
+/**
* Groups created so create an access list for it
*/
function groups_create_event_listener($event, $object_type, $object) {
@@ -734,7 +776,7 @@ function discussion_add_to_river_menu($hook, $type, $return, $params) {
'href' => "#groups-reply-$object->guid",
'text' => elgg_view_icon('speech-bubble'),
'title' => elgg_echo('reply:this'),
- 'class' => "elgg-toggler",
+ 'link_class' => "elgg-toggler",
'priority' => 50,
);
$return[] = ElggMenuItem::factory($options);
diff --git a/mod/groups/views/default/forms/groups/delete.php b/mod/groups/views/default/forms/groups/delete.php
deleted file mode 100644
index 28c2eb9bf..000000000
--- a/mod/groups/views/default/forms/groups/delete.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/**
- * Group delete form body
- */
-
-$warning = elgg_echo("groups:deletewarning");
-
-echo elgg_view('input/hidden', array(
- 'name' => 'group_guid',
- 'value' => $vars['entity']->getGUID(),
-));
-
-echo elgg_view('input/submit', array(
- 'class' => "elgg-button elgg-button-delete right",
- 'value' => elgg_echo('groups:delete'),
- 'onclick' => "return confirm('$warning');",
-));
diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php
index 1a4e95513..b67134c63 100644
--- a/mod/groups/views/default/forms/groups/edit.php
+++ b/mod/groups/views/default/forms/groups/edit.php
@@ -126,7 +126,7 @@ if ($tools) {
}
}
?>
-<div class="elgg-divide-top">
+<div class="elgg-form-footer-alt">
<?php
if (isset($vars['entity'])) {
@@ -137,5 +137,15 @@ if (isset($vars['entity'])) {
}
echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+
+if (isset($vars['entity'])) {
+ $delete_url = 'action/groups/delete?guid=' . $vars['entity']->getGUID();
+ echo elgg_view('output/confirmlink', array(
+ 'text' => elgg_echo('groups:delete'),
+ 'href' => $delete_url,
+ 'confirm' => elgg_echo('groups:deletewarning'),
+ 'class' => 'elgg-button elgg-button-delete float-alt',
+ ));
+}
?>
</div>
diff --git a/mod/groups/views/default/forms/groups/invite.php b/mod/groups/views/default/forms/groups/invite.php
index a49bbe2fb..83139c2ee 100644
--- a/mod/groups/views/default/forms/groups/invite.php
+++ b/mod/groups/views/default/forms/groups/invite.php
@@ -12,9 +12,11 @@ $friends = elgg_get_logged_in_user_entity()->getFriends('', 0);
if ($friends) {
echo elgg_view('input/friendspicker', array('entities' => $friends, 'name' => 'user_guid', 'highlight' => 'all'));
+ echo '<div class="elgg-form-footer">';
echo elgg_view('input/hidden', array('name' => 'forward_url', 'value' => $forward_url));
echo elgg_view('input/hidden', array('name' => 'group_guid', 'value' => $group->guid));
echo elgg_view('input/submit', array('value' => elgg_echo('invite')));
+ echo '</div>';
} else {
echo elgg_echo('groups:nofriendsatall');
} \ No newline at end of file
diff --git a/mod/groups/views/default/group/default.php b/mod/groups/views/default/group/default.php
index 1f1035a38..2aa377813 100644
--- a/mod/groups/views/default/group/default.php
+++ b/mod/groups/views/default/group/default.php
@@ -31,7 +31,7 @@ if ($vars['full_view']) {
'metadata' => $metadata,
'subtitle' => $group->briefdescription,
);
- $list_body = elgg_view('page/components/summary', $params);
+ $list_body = elgg_view('group/elements/summary', $params);
echo elgg_view_image_block($icon, $list_body);
}
diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php
index 06b86d1ee..37fc5dc10 100644
--- a/mod/groups/views/default/groups/css.php
+++ b/mod/groups/views/default/groups/css.php
@@ -32,6 +32,10 @@
margin-bottom: 7px;
}
+.groups-profile-fields .elgg-output {
+ margin: 0;
+}
+
#groups-tools > .elgg-module {
float: left;
margin-bottom: 40px;
diff --git a/mod/groups/views/default/groups/edit.php b/mod/groups/views/default/groups/edit.php
index 2434bd14f..5076cc49a 100644
--- a/mod/groups/views/default/groups/edit.php
+++ b/mod/groups/views/default/groups/edit.php
@@ -10,9 +10,3 @@ $entity = elgg_extract('entity', $vars, null);
$form_vars = array('enctype' => 'multipart/form-data');
$body_vars = array('entity' => $entity);
echo elgg_view_form('groups/edit', $form_vars, $body_vars);
-
-if ($entity) {
- echo '<div class="delete_group">';
- echo elgg_view_form('groups/delete', array(), array('entity' => $entity));
- echo '</div>';
-}
diff --git a/mod/groups/views/default/groups/profile/fields.php b/mod/groups/views/default/groups/profile/fields.php
index 5cd06025f..14827f11a 100644
--- a/mod/groups/views/default/groups/profile/fields.php
+++ b/mod/groups/views/default/groups/profile/fields.php
@@ -26,12 +26,12 @@ if (is_array($profile_fields) && count($profile_fields) > 0) {
$options['tag_names'] = $key;
}
- echo "<p class=\"{$even_odd}\">";
+ echo "<div class=\"{$even_odd}\">";
echo "<b>";
echo elgg_echo("groups:$key");
echo ": </b>";
echo elgg_view("output/$valtype", $options);
- echo "</p>";
+ echo "</div>";
$even_odd = ($even_odd == 'even') ? 'odd' : 'even';
}
diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php
index 9589d1fb8..3a4decbe4 100644
--- a/mod/groups/views/default/object/groupforumtopic.php
+++ b/mod/groups/views/default/object/groupforumtopic.php
@@ -67,7 +67,7 @@ if ($full) {
'subtitle' => $subtitle,
'tags' => $tags,
);
- $list_body = elgg_view('page/components/summary', $params);
+ $list_body = elgg_view('object/elements/summary', $params);
$info = elgg_view_image_block($poster_icon, $list_body);
@@ -90,7 +90,7 @@ HTML;
'tags' => $tags,
'content' => $excerpt,
);
- $list_body = elgg_view('page/components/summary', $params);
+ $list_body = elgg_view('object/elements/summary', $params);
echo elgg_view_image_block($poster_icon, $list_body);
}