Skip to content

Commit

Permalink
Fix social invitations
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Jul 25, 2016
1 parent f6f091c commit f58be9b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions main/social/invitations.php
Expand Up @@ -19,11 +19,13 @@
$interbreadcrumb[] = array ('url' =>'profile.php','name' => get_lang('SocialNetwork'));
$interbreadcrumb[] = array ('url' =>'#','name' => get_lang('Invitations'));

$userGroupModel = new UserGroup();

if (is_array($_GET) && count($_GET) > 0) {
foreach ($_GET as $key => $value) {
switch ($key) {
case 'accept':
$useRole = UserGroup::get_user_group_role(api_get_user_id(), $value);
$useRole = $userGroupModel->get_user_group_role(api_get_user_id(), $value);

if (in_array(
$useRole,
Expand All @@ -32,7 +34,7 @@
GROUP_USER_PERMISSION_PENDING_INVITATION
)
)) {
UserGroup::update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$userGroupModel->update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);

Display::addFlash(
Display::return_message(get_lang('UserIsSubscribedToThisGroup'), 'success')
Expand Down Expand Up @@ -66,7 +68,7 @@
exit;
break;
case 'deny':
UserGroup::delete_user_rel_group(api_get_user_id(), $value);
$userGroupModel->delete_user_rel_group(api_get_user_id(), $value);

Display::addFlash(
Display::return_message(get_lang('GroupInvitationWasDeny'))
Expand All @@ -78,8 +80,6 @@
}
}

$userGroup = new UserGroup();

$content = null;

// Block Menu Social
Expand All @@ -90,7 +90,7 @@
$user_id = api_get_user_id();
$list_get_invitation = SocialManager::get_list_invitation_of_friends_by_user_id($user_id);
$list_get_invitation_sent = SocialManager::get_list_invitation_sent_by_user_id($user_id);
$pending_invitations = $userGroup->get_groups_by_user(
$pending_invitations = $userGroupModel->get_groups_by_user(
$user_id,
GROUP_USER_PERMISSION_PENDING_INVITATION
);
Expand Down Expand Up @@ -195,7 +195,7 @@
$new_invitation = array();
$waitingInvitation = '';
foreach ($pending_invitations as $invitation) {
$picture = $userGroup->get_picture_group(
$picture = $userGroupModel->get_picture_group(
$invitation['id'],
$invitation['picture'],
80
Expand Down

0 comments on commit f58be9b

Please sign in to comment.