Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
fix(friends): announce new friendships on river
Browse files Browse the repository at this point in the history
  • Loading branch information
hypeJunction committed Sep 29, 2016
1 parent 21f2082 commit da7bc26
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions classes/hypeJunction/Invite/InviteService.php
Expand Up @@ -294,11 +294,17 @@ public static function addFriendships($hook, $type, $return, $params) {

foreach ($inviters as $inviter) {
/* @var $inviter ElggUser */

// We will respect frien_request setting for river events
$add_to_river = true;
if (elgg_is_active_plugin('friend_request')) {
$add_to_river = elgg_get_plugin_setting('add_river', 'friend_request') !== 'no';
}

if (elgg_is_active_plugin('friend_request')) {
if ($accept_on_register) {
add_entity_relationship($inviter->guid, 'friend', $user->guid);
add_entity_relationship($user->guid, 'friend', $inviter->guid);
$inviter->addFriend($user->guid, $add_to_river); // add to river
$user->addFriend($inviter->guid, $add_to_river);
} else if (!$inviter->isFriendsWith($user->guid)) {
add_entity_relationship($inviter->guid, 'friendrequest', $user->guid);
}
Expand Down

0 comments on commit da7bc26

Please sign in to comment.