diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-03 03:33:52 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-03 03:33:52 +0000 |
commit | 949a233076ec18f86e60f90a7a8837cb422664af (patch) | |
tree | 0286c9cb2c3301a164505e39dccf02a4e0a98497 /mod/groups/actions/joinrequest.php | |
parent | d4e4268d11612408e4989a5c57f69fcb2febe8aa (diff) | |
download | elgg-949a233076ec18f86e60f90a7a8837cb422664af.tar.gz elgg-949a233076ec18f86e60f90a7a8837cb422664af.tar.bz2 |
Refs #2428 almost done removing CONFIG access - mostly plugin start.php left
git-svn-id: http://code.elgg.org/elgg/trunk@7999 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups/actions/joinrequest.php')
-rw-r--r-- | mod/groups/actions/joinrequest.php | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/mod/groups/actions/joinrequest.php b/mod/groups/actions/joinrequest.php index b61afbed6..c1d41e8e8 100644 --- a/mod/groups/actions/joinrequest.php +++ b/mod/groups/actions/joinrequest.php @@ -5,9 +5,6 @@ * @package ElggGroups */ -// Load configuration -global $CONFIG; - $user_guid = get_input('user_guid', get_loggedin_userid()); $group_guid = get_input('group_guid'); @@ -27,17 +24,14 @@ $group = get_entity($group_guid); set_page_owner($group->guid); // If not a member of this group -if (($group) && ($user) && (!$group->isMember($user))) -{ +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)) - { + if ($group->join($user)) { // Remove relationships remove_entity_relationship($group->guid, 'invited', $user->guid); remove_entity_relationship($user->guid, 'membership_request', $group->guid); @@ -47,33 +41,29 @@ if (($group) && ($user) && (!$group->isMember($user))) elgg_set_ignore_access($ia); forward($group->getURL()); - exit; - } - else { + } else { elgg_set_ignore_access($ia); system_message(elgg_echo('groups:cantjoin')); } - } - else - { + } else { // If join request not already made - if (!check_entity_relationship($user->guid, 'membership_request', $group->guid)) - { + 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 = "{$CONFIG->url}mod/groups/membershipreq.php?group_guid={$group->guid}"; + $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)) + NULL)) { system_message(elgg_echo("groups:joinrequestmade")); - else + } else { register_error(elgg_echo("groups:joinrequestnotmade")); - } - else + } + } else { system_message(elgg_echo("groups:joinrequestmade")); + } } } |