diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-02-27 13:45:20 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-02-27 13:45:20 +0000 |
commit | b8774c56edb22840530c6f2ddcbe2f2022a417d1 (patch) | |
tree | dcca0992744a46df9a3dbf597ce2b8febe8dc4d0 /mod/groups | |
parent | e658fb3a978e40653d72ef33549177c87cb714ce (diff) | |
download | elgg-b8774c56edb22840530c6f2ddcbe2f2022a417d1.tar.gz elgg-b8774c56edb22840530c6f2ddcbe2f2022a417d1.tar.bz2 |
Join request management added.
git-svn-id: https://code.elgg.org/elgg/trunk@2980 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups')
-rw-r--r-- | mod/groups/actions/addtogroup.php | 4 | ||||
-rw-r--r-- | mod/groups/actions/groupskillrequest.php | 32 | ||||
-rw-r--r-- | mod/groups/languages/en.php | 5 | ||||
-rw-r--r-- | mod/groups/membershipreq.php | 4 | ||||
-rw-r--r-- | mod/groups/start.php | 2 | ||||
-rw-r--r-- | mod/groups/views/default/groups/membershiprequests.php | 35 |
6 files changed, 71 insertions, 11 deletions
diff --git a/mod/groups/actions/addtogroup.php b/mod/groups/actions/addtogroup.php index a34f5d48c..97f10aef2 100644 --- a/mod/groups/actions/addtogroup.php +++ b/mod/groups/actions/addtogroup.php @@ -44,7 +44,9 @@ // 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);
+ // send welcome email notify_user($user->getGUID(), $group->owner_guid, sprintf(elgg_echo('groups:welcome:subject'), $group->name), diff --git a/mod/groups/actions/groupskillrequest.php b/mod/groups/actions/groupskillrequest.php new file mode 100644 index 000000000..a2734abb9 --- /dev/null +++ b/mod/groups/actions/groupskillrequest.php @@ -0,0 +1,32 @@ +<?php
+ /**
+ * Delete a user request to join a closed group.
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+ // Load configuration
+ global $CONFIG;
+
+ gatekeeper();
+
+ $user_guid = get_input('user_guid', get_loggedin_userid());
+ $group_guid = get_input('group_guid');
+
+ $user = get_entity($user_guid);
+ $group = get_entity($group_guid);
+
+ // If join request made
+ if (check_entity_relationship($user->guid, 'membership_request', $group->guid))
+ {
+ remove_entity_relationship($user->guid, 'membership_request', $group->guid);
+ system_message(elgg_echo("groups:joinrequestkilled"));
+ }
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?>
\ No newline at end of file diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 3f3505b02..95cad18ed 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -75,7 +75,7 @@ */
'groups:access:private' => 'Closed - Users must be invited',
'groups:access:public' => 'Open - Any user may join',
- 'groups:closedgroup' => 'This group has a closed membership, please request to join.',
+ 'groups:closedgroup' => 'This group has a closed membership. To ask to be added, click the "request membership" menu link.',
/*
Group tools
@@ -138,6 +138,7 @@ 'groups:updated' => "Last comment",
'groups:invite:subject' => "%s you have been invited to join %s!",
'groups:started' => "Started by",
+ 'groups:joinrequest:remove:check' => 'Are you sure you want to remove this join request?',
'groups:invite:body' => "Hi %s,
You have been invited to join the '%s' group, click below to confirm:
@@ -203,6 +204,8 @@ or click below to confirm request: 'groupstopic:notdeleted' => 'Topic not deleted',
'grouptopic:blank' => 'No topic',
'groups:deletewarning' => "Are you sure you want to delete this group? There is no undo!",
+
+ 'groups:joinrequestkilled' => 'The join request has been deleted.',
);
add_translation("en",$english);
diff --git a/mod/groups/membershipreq.php b/mod/groups/membershipreq.php index 983f8d363..7e67a7cda 100644 --- a/mod/groups/membershipreq.php +++ b/mod/groups/membershipreq.php @@ -23,8 +23,8 @@ if (($group) && ($group->canEdit()))
{
- $requests = get_entities_from_relationship('membership_request',$group_guid,false,'','',0,'',9999);
- $area2 .= elgg_view('groups/membershiprequests',array('requests' => $requests));
+ $requests = get_entities_from_relationship('membership_request',$group_guid,true,'','',0,'',9999);
+ $area2 .= elgg_view('groups/membershiprequests',array('requests' => $requests, 'entity' => $group));
} else {
$area2 .= elgg_echo("groups:noaccess");
diff --git a/mod/groups/start.php b/mod/groups/start.php index f609ef90d..64a44bf21 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -45,7 +45,7 @@ register_action("groups/join",false, $CONFIG->pluginspath . "groups/actions/join.php");
register_action("groups/leave",false, $CONFIG->pluginspath . "groups/actions/leave.php");
register_action("groups/joinrequest",false, $CONFIG->pluginspath . "groups/actions/joinrequest.php");
-
+ register_action("groups/killrequest",false,$CONFIG->pluginspath . "groups/actions/groupskillrequest.php");
register_action("groups/addtogroup",false, $CONFIG->pluginspath . "groups/actions/addtogroup.php");
// Use group widgets
diff --git a/mod/groups/views/default/groups/membershiprequests.php b/mod/groups/views/default/groups/membershiprequests.php index f442c1a93..9279e2bee 100644 --- a/mod/groups/views/default/groups/membershiprequests.php +++ b/mod/groups/views/default/groups/membershiprequests.php @@ -1,3 +1,5 @@ +<div class="contentWrapper">
+
<?php
if (!empty($vars['requests']) && is_array($vars['requests'])) {
@@ -7,13 +9,35 @@ ?>
<div class="reportedcontent_content active_report">
- <p class="reportedcontent_detail">
+ <div class="groups_membershiprequest_buttons">
<?php
-
- echo $request->name;
+
+ echo str_replace('<a', '<a class="delete_report_button" ', elgg_view('output/confirmlink',array(
+ 'href' => $vars['url'] . 'action/groups/killrequest?user_guid='.$request->guid.'&group_guid=' . $vars['entity']->guid,
+ 'confirm' => elgg_echo('groups:joinrequest:remove:check'),
+ 'text' => elgg_echo('delete'),
+ )));
?>
+ <a href="<?php echo $vars['url']; ?>action/groups/addtogroup?user_guid=<?php echo $request->guid; ?>&group_guid=<?php echo $vars['entity']->guid; ?>" class="archive_report_button"><?php echo elgg_echo('accept'); ?></a>
+ </div>
+ <p class="reportedcontent_detail">
+ <a href="<?php echo $request->getURL(); ?>"><?php echo $request->name; ?></a>
+ </p>
+ <?php
+
+ $status = elgg_view("profile/status", array("entity" => $request));
+ if (!empty($status)) {
+
+ ?>
+ <p class="reportedcontent_detail">
+ <?php echo $status; ?>
</p>
+ <?php
+
+ } else echo "<p class=\"reportedcontent_detail\"> </p>";
+
+ ?>
</div>
<?php
@@ -21,10 +45,9 @@ } else {
- echo "<div class=\"contentWrapper\">";
echo "<p>" . elgg_echo('groups:requests:none') . "</p>";
- echo "</div>";
}
-?>
\ No newline at end of file +?>
+</div>
\ No newline at end of file |