Commit d9c68413 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

chaning cancel so it returns to myfriends/find/view page depeding on how the page was navigated to

parent 1b6d5f0f
......@@ -14,16 +14,16 @@
<img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxsize=100&amp;id={$USERID}" alt="">
{if $canmessage}
<br>
<a href="{$WWWROOT}user/sendmessage.php?id={$USERID}">{str tag='sendmessage' section='group'}</a>
<a href="{$WWWROOT}user/sendmessage.php?id={$USERID}&amp;returnto=view">{str tag='sendmessage' section='group'}</a>
{/if}
{if $relationship == 'existingfriend'}
<br>
<a href="{$WWWROOT}user/removefriend.php?id={$USERID}">{str tag='removefromfriendslist' section='group'}</a>
<a href="{$WWWROOT}user/removefriend.php?id={$USERID}&amp;returnto=view">{str tag='removefromfriendslist' section='group'}</a>
{elseif $relationship == 'none' && $friendscontrol == 'auto'}
{$newfriendform}
{elseif $relationship == 'none' && $friendscontrol == 'auth'}
<br>
<a href="{$WWWROOT}user/requestfriendship.php?id={$USERID}">{str tag='requestfriendship' section='group'}</a>
<a href="{$WWWROOT}user/requestfriendship.php?id={$USERID}&amp;returnto=view">{str tag='requestfriendship' section='group'}</a>
{/if}
{if $inviteform}
{$inviteform}
......
......@@ -33,6 +33,7 @@ require('searchlib.php');
safe_require('search', 'internal');
$id = param_integer('id');
$returnto = param_alpha('returnto', 'myfriends');
if (!record_exists('usr_friend_request', 'owner', $USER->get('id'), 'requester', $id)) {
throw new AccessDeniedException(get_string('cantdenyrequest', 'group'));
......@@ -51,7 +52,7 @@ $form = pieform(array(
'submit' => array(
'type' => 'submitcancel',
'value' => array(get_string('denyfriendrequestlower', 'group'), get_string('cancel')),
'goto' => get_config('wwwroot') . 'user/view.php?id=' . $id,
'goto' => get_config('wwwroot') . ($returnto == 'find' ? 'user/find.php' : ($returnto == 'view' ? 'user/view.php?id=' . $id : 'user/myfriends.php')),
)
)
));
......
......@@ -30,6 +30,7 @@ require(dirname(dirname(__FILE__)) . '/init.php');
require_once('pieforms/pieform.php');
$id = param_integer('id');
$returnto = param_alpha('returnto', 'myfriends');
if (!is_friend($id, $USER->get('id'))) {
throw new AccessDeniedException(get_string('cantremovefriend', 'group'));
......@@ -50,7 +51,7 @@ $form = pieform(array(
'submit' => array(
'type' => 'submitcancel',
'value' => array(get_string('removefriend', 'group'), get_string('cancel')),
'goto' => get_config('wwwroot') , 'user/view.php?id=' . $id
'goto' => get_config('wwwroot') . ($returnto == 'find' ? 'user/find.php' : ($returnto == 'view' ? 'user/view.php?id=' . $id : 'user/myfriends.php')),
)
)
));
......
......@@ -30,6 +30,7 @@ require(dirname(dirname(__FILE__)) . '/init.php');
require_once('pieforms/pieform.php');
$id = param_integer('id');
$returnto = param_alpha('returnto', 'myfriends');
if (is_friend($id, $USER->get('id'))
|| get_friend_request($id, $USER->get('id'))
......@@ -53,7 +54,7 @@ $form = pieform(array(
'submit' => array(
'type' => 'submitcancel',
'value' => array(get_string('requestfriendship', 'group'), get_string('cancel')),
'goto' => get_config('wwwroot') . 'user/view.php?id=' . $id,
'goto' => get_config('wwwroot') . ($returnto == 'find' ? 'user/find.php' : ($returnto == 'view' ? 'user/view.php?id=' . $id : 'user/myfriends.php')),
)
)
));
......
......@@ -32,6 +32,7 @@ require('searchlib.php');
safe_require('search', 'internal');
$id = param_integer('id');
$returnto = param_alpha('returnto', 'myfriends');
if (!can_send_message($USER, $id)) {
throw new AccessDeniedException(get_string('cantmessageuser', 'group'));
......@@ -52,7 +53,7 @@ $form = pieform(array(
'submit' => array(
'type' => 'submitcancel',
'value' => array(get_string('sendmessage', 'group'), get_string('cancel')),
'goto' => get_config('wwwroot') . 'user/view.php?id=' . $id,
'goto' => get_config('wwwroot') . ($returnto == 'find' ? 'user/find.php' : ($returnto == 'view' ? 'user/view.php?id=' . $id : 'user/myfriends.php')),
)
)
));
......
......@@ -366,7 +366,7 @@ function addmember_submit(Pieform $form, $values) {
function approve_deny_friendrequest_submit(Pieform $form, $values) {
if (isset($values['deny'])) {
redirect('/user/denyrequest.php?id=' . $values['id']);
redirect('/user/denyrequest.php?id=' . $values['id'] . '&returnto=view');
}
else {
acceptfriend_submit($form, $values);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment