Skip to content

Commit

Permalink
Showing 2 changed files with 41 additions and 41 deletions.
78 changes: 39 additions & 39 deletions lib/events.php
Original file line number Diff line number Diff line change
@@ -111,49 +111,49 @@ function group_tools_multiple_admin_group_leave($event, $type, $params){


function group_tools_membership_request($event, $type, $relationship) {
if (!($relationship instanceof ElggRelationship)) {
return;
}
$group = get_entity($relationship->guid_two);
$user = get_user($relationship->guid_one);
if (!elgg_instanceof($group, 'group') || !elgg_instanceof($user, 'user')) {
return;
}
// Notify group owner
$url = elgg_get_site_url() . "groups/requests/$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,
));
$options = array(
if (!($relationship instanceof ElggRelationship)) {
return;
}

$group = get_entity($relationship->guid_two);
$user = get_user($relationship->guid_one);

if (!elgg_instanceof($group, 'group') || !elgg_instanceof($user, 'user')) {
return;
}

// Notify group owner
$url = elgg_get_site_url() . "groups/requests/$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,
));

$options = array(
"relationship" => "group_admin",
"relationship_guid" => $group->getGUID(),
"inverse_relationship" => true,
"type" => "user",
"limit" => false,
"wheres" => array("e.guid <> " . $group->owner_guid),
"callback" => false
"callback" => false
);
$admins = elgg_get_entities_from_relationship($options);
$guids = array();
foreach ($admins as $a) {
$guids[] = $a->guid;
}
if ($guids) {
notify_user($guids, $user->getGUID(), $subject, $body);
}
}

$admins = elgg_get_entities_from_relationship($options);

$guids = array();
foreach ($admins as $a) {
$guids[] = $a->guid;
}

if ($guids) {
notify_user($guids, $user->getGUID(), $subject, $body);
}
}
4 changes: 2 additions & 2 deletions start.php
Original file line number Diff line number Diff line change
@@ -35,8 +35,8 @@ function group_tools_init(){
// register on group leave
elgg_register_event_handler("leave", "group", "group_tools_multiple_admin_group_leave");

//notify admin on membership request
elgg_register_event_handler('create', 'membership_request', 'group_tools_membership_request');
//notify admin on membership request
elgg_register_event_handler('create', 'membership_request', 'group_tools_membership_request');
}

// register group activity widget

0 comments on commit 84cbd97

Please sign in to comment.