From f6ff517215d63d55c47a212a7a3ee477d4def791 Mon Sep 17 00:00:00 2001 From: marcus Date: Thu, 3 Jul 2008 18:54:08 +0000 Subject: End of day commit of first (semi working) code. Working: - Join/leave on public groups - Create / edit groups Not working: - Private groups - the skin/display of the group - profile main page - widgets Refs #109 Closes #115 git-svn-id: https://code.elgg.org/elgg/trunk@1279 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/groups/actions/joinrequest.php | 73 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 mod/groups/actions/joinrequest.php (limited to 'mod/groups/actions/joinrequest.php') diff --git a/mod/groups/actions/joinrequest.php b/mod/groups/actions/joinrequest.php new file mode 100644 index 000000000..6288e0e76 --- /dev/null +++ b/mod/groups/actions/joinrequest.php @@ -0,0 +1,73 @@ +isMember($user)) + { + $invites = $user->group_invite; + + if ($invites) + { + foreach ($invites as $invite) + { + if ($invite = $group->getGUID()) + { + if ($group->join($user)) + { + system_message(elgg_echo('groups:joined')); + + forward($group->getURL()); + exit; + } + else + system_message(elgg_echo('groups:cantjoin')); + + forward($_SERVER['HTTP_REFERER']); + exit; + } + + } + + // else email membership requiest + // set flag + + if (!$user->setMetaData('group_join_request', $group->getGUID(), "", true)) + system_message(elgg_echo("groups:joinrequestnotmade")); + else + { + // Send email + if (notify_user($group->owner_guid, "", + sprintf(elgg_echo('groups:request:subject'), $user->name, $group->title), + sprintf(elgg_echo('groups:request:body'), $group->getOwner()->name, $user->name, $group->title, $user->getURL(), "http://{$CONFIG->url}action/groups/addtogroup?user_guid={$user->guid}&group_guid={$group->guid}"), + NULL, "email")) + system_message(elgg_echo("groups:joinrequestmade")); + else + system_message(elgg_echo("groups:joinrequestnotmade")); + } + } + + } + else + system_message(elgg_echo('groups:alreadymember')); + + forward($_SERVER['HTTP_REFERER']); + exit; +?> \ No newline at end of file -- cgit v1.2.3