aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/actions/addtogroup.php77
-rw-r--r--mod/groups/actions/groups/delete.php (renamed from mod/groups/actions/delete.php)5
-rw-r--r--mod/groups/actions/groups/edit.php (renamed from mod/groups/actions/edit.php)15
-rw-r--r--mod/groups/actions/groups/featured.php (renamed from mod/groups/actions/featured.php)1
-rw-r--r--mod/groups/actions/groups/membership/add.php42
-rw-r--r--mod/groups/actions/groups/membership/delete_invite.php (renamed from mod/groups/actions/groupskillinvitation.php)2
-rw-r--r--mod/groups/actions/groups/membership/delete_request.php (renamed from mod/groups/actions/groupskillrequest.php)2
-rw-r--r--mod/groups/actions/groups/membership/invite.php51
-rw-r--r--mod/groups/actions/groups/membership/join.php70
-rw-r--r--mod/groups/actions/groups/membership/leave.php (renamed from mod/groups/actions/leave.php)0
-rw-r--r--mod/groups/actions/invite.php54
-rw-r--r--mod/groups/actions/join.php50
-rw-r--r--mod/groups/actions/joinrequest.php70
-rw-r--r--mod/groups/start.php48
-rw-r--r--mod/groups/views/default/groups/invitationrequests.php55
-rw-r--r--mod/groups/views/default/groups/profile/buttons.php6
16 files changed, 241 insertions, 307 deletions
diff --git a/mod/groups/actions/addtogroup.php b/mod/groups/actions/addtogroup.php
deleted file mode 100644
index d75c5fdb8..000000000
--- a/mod/groups/actions/addtogroup.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * Add a user to a group
- *
- * @package ElggGroups
- */
-$logged_in_user = elgg_get_logged_in_user_entity();
-
-$user_guid = get_input('user_guid');
-if (!is_array($user_guid))
- $user_guid = array($user_guid);
-$group_guid = get_input('group_guid');
-
-if (sizeof($user_guid)) {
- foreach ($user_guid as $u_id) {
- $user = get_entity($u_id);
- $group = get_entity($group_guid);
-
- set_page_owner($group->guid);
-
- if ($user && $group) {
-
- //if (elgg_get_logged_in_user_guid() == $group->owner_guid)
- if ($group->canEdit()) {
-
- // If the group is open or the user has requested membership
- if (
- (check_entity_relationship($user->guid, 'membership_request', $group->guid)) ||
- ($group->isPublicMembership())
- ) {
-
- if (!$group->isMember($user)) {
- // Remove relationships
- remove_entity_relationship($group->guid, 'invited', $user->guid);
- remove_entity_relationship($user->guid, 'membership_request', $group->guid);
-
- //add_entity_relationship($user->guid, 'member', $group->guid);
- $group->join($user);
-
- // send welcome email
- notify_user($user->getGUID(), $group->owner_guid,
- elgg_echo('groups:welcome:subject', array($group->name)),
- elgg_echo('groups:welcome:body', array($user->name, $group->name, $group->getURL())),
- NULL);
-
- system_message(elgg_echo('groups:addedtogroup'));
- }
- else
- register_error(elgg_echo("groups:cantjoin"));
- }
- else {
- if ($user->isFriend()) {
-
- // Create relationship
- add_entity_relationship($group->guid, 'invited', $user->guid);
-
- // Send email
- $url = elgg_get_site_url() . "pg/groups/invited?user_guid={$user->guid}&group_guid={$group->guid}";
- if (notify_user($user->getGUID(), $group->owner_guid,
- elgg_echo('groups:invite:subject', array($user->name, $group->name)),
- elgg_echo('groups:invite:body', array($user->name, $logged_in_user->name, $group->name, $url)),
- NULL))
- system_message(elgg_echo("groups:userinvited"));
- else
- register_error(elgg_echo("groups:usernotinvited"));
- }
- else
- register_error(elgg_echo("groups:usernotinvited"));
- }
- }
- else
- register_error(elgg_echo("groups:notowner"));
- }
- }
-}
-
-forward(REFERER);
diff --git a/mod/groups/actions/delete.php b/mod/groups/actions/groups/delete.php
index 6eed12a9c..9ed7954dc 100644
--- a/mod/groups/actions/delete.php
+++ b/mod/groups/actions/groups/delete.php
@@ -6,6 +6,11 @@
$guid = (int) get_input('group_guid');
$entity = get_entity($guid);
+if (!$entity->canEdit()) {
+ register_error(elgg_echo('group:notdeleted'));
+ forward(REFERER);
+}
+
if (($entity) && ($entity instanceof ElggGroup)) {
// delete group icons
$owner_guid = $entity->owner_guid;
diff --git a/mod/groups/actions/edit.php b/mod/groups/actions/groups/edit.php
index baa1a7065..b3c39c461 100644
--- a/mod/groups/actions/edit.php
+++ b/mod/groups/actions/groups/edit.php
@@ -44,7 +44,6 @@ if (($group_guid) && (!$group->canEdit())) {
register_error(elgg_echo("groups:cantedit"));
forward(REFERER);
- exit;
}
// Assume we can edit or this is a new group
@@ -59,7 +58,6 @@ if (!$group->name) {
register_error(elgg_echo("groups:notitle"));
forward(REFERER);
- exit;
}
// Group membership - should these be treated with same constants as access permissions?
@@ -73,7 +71,7 @@ switch (get_input('membership')) {
// Set access - all groups are public from elgg's point of view, unless the override is in place
if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
- $visibility = (int)get_input('vis','',false);
+ $visibility = (int)get_input('vis', '', false);
$group->access_id = $visibility;
} else {
@@ -81,14 +79,9 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
}
// Set group tool options
-//$group->files_enable = get_input('files_enable', 'yes');
-//$group->pages_enable = get_input('pages_enable', 'yes');
-//$group->forum_enable = get_input('forum_enable', 'yes');
-
-// Set group tool options
if (isset($CONFIG->group_tool_options)) {
- foreach($CONFIG->group_tool_options as $group_option) {
- $group_option_toggle_name = $group_option->name."_enable";
+ foreach ($CONFIG->group_tool_options as $group_option) {
+ $group_option_toggle_name = $group_option->name . "_enable";
if ($group_option->default_on) {
$group_option_default_value = 'yes';
} else {
@@ -156,6 +149,4 @@ if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))
system_message(elgg_echo("groups:saved"));
-
forward($group->getUrl());
-
diff --git a/mod/groups/actions/featured.php b/mod/groups/actions/groups/featured.php
index 72ca7eebd..2d623b1e4 100644
--- a/mod/groups/actions/featured.php
+++ b/mod/groups/actions/groups/featured.php
@@ -5,7 +5,6 @@
* @package ElggGroups
*/
-
$group_guid = get_input('group_guid');
$action = get_input('action_type');
diff --git a/mod/groups/actions/groups/membership/add.php b/mod/groups/actions/groups/membership/add.php
new file mode 100644
index 000000000..de0cba613
--- /dev/null
+++ b/mod/groups/actions/groups/membership/add.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Add users to a group
+ *
+ * @package ElggGroups
+ */
+$logged_in_user = elgg_get_logged_in_user_entity();
+
+$user_guid = get_input('user_guid');
+if (!is_array($user_guid)) {
+ $user_guid = array($user_guid);
+}
+$group_guid = get_input('group_guid');
+$group = get_entity($group_guid);
+
+if (sizeof($user_guid)) {
+ foreach ($user_guid as $u_id) {
+ $user = get_user($u_id);
+
+ if ($user && $group && $group->canEdit()) {
+ if (!$group->isMember($user)) {
+ if (groups_join_group($group, $user)) {
+
+ // send welcome email to user
+ notify_user($user->getGUID(), $group->owner_guid,
+ elgg_echo('groups:welcome:subject', array($group->name)),
+ elgg_echo('groups:welcome:body', array(
+ $user->name,
+ $group->name,
+ $group->getURL())
+ ));
+
+ system_message(elgg_echo('groups:addedtogroup'));
+ } else {
+ // huh
+ }
+ }
+ }
+ }
+}
+
+forward(REFERER);
diff --git a/mod/groups/actions/groupskillinvitation.php b/mod/groups/actions/groups/membership/delete_invite.php
index 516490bc9..4b654f0b6 100644
--- a/mod/groups/actions/groupskillinvitation.php
+++ b/mod/groups/actions/groups/membership/delete_invite.php
@@ -1,6 +1,6 @@
<?php
/**
- * Delete an invitation to join a closed group.
+ * Delete an invitation to join a group.
*
* @package ElggGroups
*/
diff --git a/mod/groups/actions/groupskillrequest.php b/mod/groups/actions/groups/membership/delete_request.php
index 9d45bb25f..883c9d748 100644
--- a/mod/groups/actions/groupskillrequest.php
+++ b/mod/groups/actions/groups/membership/delete_request.php
@@ -1,6 +1,6 @@
<?php
/**
- * Delete a user request to join a closed group.
+ * Delete a request to join a closed group.
*
* @package ElggGroups
*/
diff --git a/mod/groups/actions/groups/membership/invite.php b/mod/groups/actions/groups/membership/invite.php
new file mode 100644
index 000000000..b106e4869
--- /dev/null
+++ b/mod/groups/actions/groups/membership/invite.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Invite users to join a group
+ *
+ * @package ElggGroups
+ */
+
+$logged_in_user = elgg_get_logged_in_user_entity();
+
+$user_guid = get_input('user_guid');
+if (!is_array($user_guid)) {
+ $user_guid = array($user_guid);
+}
+$group_guid = get_input('group_guid');
+
+if (sizeof($user_guid)) {
+ foreach ($user_guid as $u_id) {
+ $user = get_entity($u_id);
+ $group = get_entity($group_guid);
+
+ if ($user && $group && ($group instanceof ElggGroup) && $group->canEdit()) {
+
+ if (!check_entity_relationship($group->guid, 'invited', $user->guid)) {
+
+ // Create relationship
+ add_entity_relationship($group->guid, 'invited', $user->guid);
+
+ // Send email
+ $url = elgg_normalize_url("pg/groups/invitations/$user->username");
+ $result = notify_user($user->getGUID(), $group->owner_guid,
+ elgg_echo('groups:invite:subject', array($user->name, $group->name)),
+ elgg_echo('groups:invite:body', array(
+ $user->name,
+ $logged_in_user->name,
+ $group->name,
+ $url,
+ )),
+ NULL);
+ if ($result) {
+ system_message(elgg_echo("groups:userinvited"));
+ } else {
+ register_error(elgg_echo("groups:usernotinvited"));
+ }
+ } else {
+ register_error(elgg_echo("groups:useralreadyinvited"));
+ }
+ }
+ }
+}
+
+forward(REFERER);
diff --git a/mod/groups/actions/groups/membership/join.php b/mod/groups/actions/groups/membership/join.php
new file mode 100644
index 000000000..3c4571a59
--- /dev/null
+++ b/mod/groups/actions/groups/membership/join.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Join a group
+ *
+ * Three states:
+ * open group so user joins
+ * closed group so request sent to group owner
+ * closed group with invite so user joins
+ *
+ * @package ElggGroups
+ */
+
+$user_guid = get_input('user_guid', elgg_get_logged_in_user_guid());
+$group_guid = get_input('group_guid');
+
+$user = get_entity($user_guid);
+
+// @todo investigate if the access bypass is needed
+$ia = elgg_set_ignore_access(true);
+$group = get_entity($group_guid);
+elgg_set_ignore_access($ia);
+
+if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) {
+
+ // join or request
+ $join = false;
+ if ($group->isPublicMembership() || $group->canEdit($user->guid)) {
+ // anyone can join public groups and admins can join any group
+ $join = true;
+ } else {
+ if (check_entity_relationship($user->guid, 'membership_request', $group->guid)) {
+ // user has invite to closed group
+ $join = true;
+ }
+ }
+
+ if ($join) {
+ if (groups_join_group($group, $user)) {
+ system_message(elgg_echo("groups:joined"));
+ forward($group->getURL());
+ } else {
+ register_error(elgg_echo("groups:cantjoin"));
+ }
+ } else {
+ add_entity_relationship($user->guid, 'membership_request', $group->guid);
+
+ // Notify group owner
+ $url = "{$CONFIG->url}mod/groups/membershipreq.php?group_guid={$group->guid}";
+ $subject = elgg_echo('groups:request:subject', array(
+ $user->name,
+ $group->name,
+ ));
+ $body = elgg_echo('groups:request:body', array(
+ $group->getOwnerEntity()->name,
+ $user->name,
+ $group->name,
+ $user->getURL(),
+ $url,
+ ));
+ if (notify_user($group->owner_guid, $user->getGUID(), $subject, $body)) {
+ system_message(elgg_echo("groups:joinrequestmade"));
+ } else {
+ register_error(elgg_echo("groups:joinrequestnotmade"));
+ }
+ }
+} else {
+ register_error(elgg_echo("groups:cantjoin"));
+}
+
+forward(REFERER);
diff --git a/mod/groups/actions/leave.php b/mod/groups/actions/groups/membership/leave.php
index 390870df1..390870df1 100644
--- a/mod/groups/actions/leave.php
+++ b/mod/groups/actions/groups/membership/leave.php
diff --git a/mod/groups/actions/invite.php b/mod/groups/actions/invite.php
deleted file mode 100644
index 1f8281071..000000000
--- a/mod/groups/actions/invite.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Invite a user to join a group
- *
- * @package ElggGroups
- */
-
-$logged_in_user = elgg_get_logged_in_user_entity();
-
-$user_guid = get_input('user_guid');
-if (!is_array($user_guid)) {
- $user_guid = array($user_guid);
-}
-$group_guid = get_input('group_guid');
-
-if (sizeof($user_guid)) {
- foreach ($user_guid as $u_id) {
- $user = get_entity($u_id);
- $group = get_entity($group_guid);
-
- if ( $user && $group) {
-
- if (($group instanceof ElggGroup) && ($group->canEdit())) {
- if (!check_entity_relationship($group->guid, 'invited', $user->guid)) {
- if ($user->isFriend()) {
-
- // Create relationship
- add_entity_relationship($group->guid, 'invited', $user->guid);
-
- // Send email
- $url = elgg_normalize_url("pg/groups/invitations/$user->username");
- $result = notify_user($user->getGUID(), $group->owner_guid,
- elgg_echo('groups:invite:subject', array($user->name, $group->name)),
- elgg_echo('groups:invite:body', array($user->name, $logged_in_user->name, $group->name, $url)),
- NULL);
- if ($result) {
- system_message(elgg_echo("groups:userinvited"));
- } else {
- register_error(elgg_echo("groups:usernotinvited"));
- }
- } else {
- register_error(elgg_echo("groups:usernotinvited"));
- }
- } else {
- register_error(elgg_echo("groups:useralreadyinvited"));
- }
- } else {
- register_error(elgg_echo("groups:notowner"));
- }
- }
- }
-}
-
-forward(REFERER);
diff --git a/mod/groups/actions/join.php b/mod/groups/actions/join.php
deleted file mode 100644
index 72294c3ad..000000000
--- a/mod/groups/actions/join.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * Join a group action.
- *
- * @package ElggGroups
- */
-
-$user_guid = get_input('user_guid', elgg_get_logged_in_user_guid());
-$group_guid = get_input('group_guid');
-
-// @todo fix for #287
-// disable access to get entity.
-$invitations = groups_get_invited_groups($user_guid, TRUE);
-
-if (in_array($group_guid, $invitations)) {
- $ia = elgg_set_ignore_access(TRUE);
-}
-
-$user = get_entity($user_guid);
-$group = get_entity($group_guid);
-
-set_page_owner($group->guid);
-
-if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) {
- if ($group->isPublicMembership() || $group->canEdit($user->guid)) {
- if ($group->join($user)) {
- system_message(elgg_echo("groups:joined"));
-
- // Remove any invite or join request flags
- remove_entity_relationship($group->guid, 'invited', $user->guid);
- remove_entity_relationship($user->guid, 'membership_request', $group->guid);
-
- // add to river
- add_to_river('river/relationship/member/create','join',$user->guid,$group->guid);
-
- forward($group->getURL());
- } else {
- register_error(elgg_echo("groups:cantjoin"));
- }
- } else {
- // Closed group, request membership
- system_message(elgg_echo('groups:privategroup'));
- forward(elgg_add_action_tokens_to_url("action/groups/joinrequest?user_guid=$user_guid&group_guid=$group_guid", FALSE));
- }
-} else {
- register_error(elgg_echo("groups:cantjoin"));
-}
-
-forward(REFERER);
-
diff --git a/mod/groups/actions/joinrequest.php b/mod/groups/actions/joinrequest.php
deleted file mode 100644
index 1631712b6..000000000
--- a/mod/groups/actions/joinrequest.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * User requests to join a closed group.
- *
- * @package ElggGroups
- */
-
-$user_guid = get_input('user_guid', elgg_get_logged_in_user_guid());
-$group_guid = get_input('group_guid');
-
-
-// @todo fix for #287
-// disable access to get entity.
-$invitations = groups_get_invited_groups($user_guid, TRUE);
-
-if (in_array($group_guid, $invitations)) {
- $ia = elgg_set_ignore_access(TRUE);
-}
-
-
-$user = get_entity($user_guid);
-$group = get_entity($group_guid);
-
-set_page_owner($group->guid);
-
-// If not a member of this group
-if (($group) && ($user) && (!$group->isMember($user))) {
- // If open group or invite exists
- if (
- ($group->isPublicMembership()) ||
- (check_entity_relationship($group->guid, 'invited', $user->guid))
- ) {
- //$ia = elgg_set_ignore_access(TRUE);
- if ($group->join($user)) {
- // Remove relationships
- remove_entity_relationship($group->guid, 'invited', $user->guid);
- remove_entity_relationship($user->guid, 'membership_request', $group->guid);
-
- // Group joined
- system_message(elgg_echo('groups:joined'));
- elgg_set_ignore_access($ia);
-
- forward($group->getURL());
- } else {
- elgg_set_ignore_access($ia);
- system_message(elgg_echo('groups:cantjoin'));
- }
- } else {
- // If join request not already made
- if (!check_entity_relationship($user->guid, 'membership_request', $group->guid)) {
- // Add membership requested
- add_entity_relationship($user->guid, 'membership_request', $group->guid);
-
- // Send email
- $url = elgg_normalize_url("mod/groups/membershipreq.php?group_guid={$group->guid}");
- if (notify_user($group->owner_guid, $user->getGUID(),
- elgg_echo('groups:request:subject', array($user->name, $group->name)),
- elgg_echo('groups:request:body', array($group->getOwnerEntity()->name, $user->name, $group->name, $user->getURL(), $url)),
- NULL)) {
- system_message(elgg_echo("groups:joinrequestmade"));
- } else {
- register_error(elgg_echo("groups:joinrequestnotmade"));
- }
- } else {
- system_message(elgg_echo("groups:joinrequestmade"));
- }
- }
-}
-
-forward(REFERER); \ No newline at end of file
diff --git a/mod/groups/start.php b/mod/groups/start.php
index fe3600dec..04f50919a 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -35,17 +35,18 @@ function groups_init() {
elgg_register_page_handler('groupicon', 'groups_icon_handler');
// Register some actions
- $action_base = elgg_get_plugins_path() . 'groups/actions';
+ $action_base = elgg_get_plugins_path() . 'groups/actions/groups';
elgg_register_action("groups/edit", "$action_base/edit.php");
elgg_register_action("groups/delete", "$action_base/delete.php");
+ elgg_register_action("groups/featured", "$action_base/featured.php", 'admin');
+
+ $action_base .= '/membership';
+ 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/joinrequest", "$action_base/joinrequest.php");
- elgg_register_action("groups/killrequest", "$action_base/groupskillrequest.php");
- elgg_register_action("groups/killinvitation", "$action_base/groupskillinvitation.php");
- elgg_register_action("groups/addtogroup", "$action_base/addtogroup.php");
- elgg_register_action("groups/invite", "$action_base/invite.php");
- elgg_register_action("groups/featured", "$action_base/featured.php", 'admin');
+ 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");
// Add some widgets
elgg_register_widget_type('a_users_groups', elgg_echo('groups:widget:membership'), elgg_echo('groups:widgets:description'));
@@ -393,24 +394,45 @@ function groups_user_leave_event_listener($event, $object_type, $object) {
* Grabs groups by invitations
* Have to override all access until there's a way override access to getter functions.
*
- * @param $user_guid
- * @return unknown_type
+ * @param int $user_guid The user's guid
+ * @param bool $return_guids Return guids rather than ElggGroup objects
+ *
+ * @return array ElggGroups or guids depending on $return_guids
*/
function groups_get_invited_groups($user_guid, $return_guids = FALSE) {
$ia = elgg_set_ignore_access(TRUE);
- $invitations = elgg_get_entities_from_relationship(array('relationship' => 'invited', 'relationship_guid' => $user_guid, 'inverse_relationship' => TRUE, 'limit' => 9999));
+ $groups = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'invited',
+ 'relationship_guid' => $user_guid,
+ 'inverse_relationship' => TRUE,
+ 'limit' => 0,
+ ));
elgg_set_ignore_access($ia);
if ($return_guids) {
$guids = array();
- foreach ($invitations as $invitation) {
- $guids[] = $invitation->getGUID();
+ foreach ($groups as $group) {
+ $guids[] = $group->getGUID();
}
return $guids;
}
- return $invitations;
+ return $groups;
+}
+
+function groups_join_group($group, $user) {
+ if ($group->join($user)) {
+ // Remove any invite or join request flags
+ remove_entity_relationship($group->guid, 'invited', $user->guid);
+ remove_entity_relationship($user->guid, 'membership_request', $group->guid);
+
+ add_to_river('river/relationship/member/create', 'join', $user->guid, $group->guid);
+
+ return true;
+ }
+
+ return false;
}
/**
diff --git a/mod/groups/views/default/groups/invitationrequests.php b/mod/groups/views/default/groups/invitationrequests.php
index 60a0ec853..11cac52de 100644
--- a/mod/groups/views/default/groups/invitationrequests.php
+++ b/mod/groups/views/default/groups/invitationrequests.php
@@ -1,37 +1,44 @@
<?php
+/**
+ * A user's group invitations
+ *
+ * @uses $vars['invitations']
+ */
if (!empty($vars['invitations']) && is_array($vars['invitations'])) {
$user = elgg_get_logged_in_user_entity();
- foreach($vars['invitations'] as $group)
+ foreach ($vars['invitations'] as $group) {
if ($group instanceof ElggGroup) {
-
- ?>
- <div class="elgg-image-block group_invitations clearfix">
- <?php
- echo "<div class='elgg-image'>";
- echo elgg_view_entity_icon($group, 'tiny', array('override' => 'true'));
- echo "</div>";
+ $icon = elgg_view_entity_icon($group, 'tiny', array('override' => 'true'));
+
+ $group_title = elgg_view('output/url', array(
+ 'href' => $group->getURL(),
+ 'text' => $group->name,
+ ));
$url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/groups/join?user_guid={$user->guid}&group_guid={$group->guid}");
- ?>
- <div class="elgg-body">
- <a href="<?php echo $url; ?>" class="elgg-button elgg-button-submit"><?php echo elgg_echo('accept'); ?></a>
- <?php
- echo str_replace('<a', '<a class="elgg-button elgg-button-action elgg-state-disabled" ', elgg_view('output/confirmlink',array(
- 'href' => "action/groups/killinvitation?user_guid={$user->getGUID()}&group_guid={$group->getGUID()}",
+ $accept_button = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('accept'),
+ 'class' => 'elgg-button elgg-button-submit',
+ ));
+
+ $url = "action/groups/killinvitation?user_guid={$user->getGUID()}&group_guid={$group->getGUID()}";
+ $delete_button = elgg_view('output/confirmlink', array(
+ 'href' => $url,
'confirm' => elgg_echo('groups:invite:remove:check'),
'text' => elgg_echo('delete'),
- )));
-
- echo "<p class='entity-title'><a href=\"" . $group->getUrl() . "\">" . $group->name . "</a></p>";
- echo "<p class='entity-subtext'>" . $group->briefdescription . "</p>";
+ 'class' => 'elgg-button elgg-button-action elgg-state-disabled',
+ ));
- ?>
- </div></div>
- <?php
+ $body = <<<HTML
+<p class="entity-title">$group_title</p>
+<p class="entity-subtext">$group->briefdescription</p>
+$accept_button $delete_button
+HTML;
+ echo elgg_view_image_block($icon, $body);
}
-
- } else {
+ }
+} else {
echo "<p class='default_string mtm'>" . elgg_echo('groups:invitations:none') . "</p>";
}
-?> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/profile/buttons.php b/mod/groups/views/default/groups/profile/buttons.php
index 0aef3920b..32d9867ab 100644
--- a/mod/groups/views/default/groups/profile/buttons.php
+++ b/mod/groups/views/default/groups/profile/buttons.php
@@ -31,14 +31,12 @@ if ($vars['entity']->isMember($user)) {
$actions[$url] = elgg_echo('groups:leave');
} else {
// join - admins can always join.
+ $url = elgg_get_site_url() . "action/groups/join?group_guid={$vars['entity']->getGUID()}";
+ $url = elgg_add_action_tokens_to_url($url);
if ($vars['entity']->isPublicMembership() || $vars['entity']->canEdit()) {
- $url = elgg_get_site_url() . "action/groups/join?group_guid={$vars['entity']->getGUID()}";
- $url = elgg_add_action_tokens_to_url($url);
$actions[$url] = elgg_echo('groups:join');
} else {
// request membership
- $url = elgg_get_site_url() . "action/groups/joinrequest?group_guid={$vars['entity']->getGUID()}";
- $url = elgg_add_action_tokens_to_url($url);
$actions[$url] = elgg_echo('groups:joinrequest');
}
}