Commit 23bd7b4a authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

changing friend control sideblock to return to find or myfriends as appropriate

parent eb7cb737
......@@ -919,7 +919,7 @@ function get_users_data($userlist) {
return $ordereddata;
}
function friends_control_sideblock() {
function friends_control_sideblock($returnto='myfriends') {
global $USER;
$form = array(
'name' => 'friendscontrol',
......@@ -944,6 +944,10 @@ function friends_control_sideblock() {
'type' => 'submit',
'value' => get_string('save')
),
'returnto' => array(
'type' => 'hidden',
'value' => $returnto
)
)
);
// Make a sideblock to put the friendscontrol block in
......@@ -958,7 +962,7 @@ function friendscontrol_submit(Pieform $form, $values) {
global $USER, $SESSION;
$USER->set_account_preference('friendscontrol', $values['friendscontrol']);
$SESSION->add_ok_msg(get_string('updatedfriendcontrolsetting', 'account'));
redirect('/user/myfriends.php');
redirect($values['returnto'] == 'find' ? '/user/find.php' : '/user/myfriends.php');
}
function acceptfriend_submit(Pieform $form, $values) {
......
......@@ -67,7 +67,7 @@ $pagination = build_pagination(array(
'resultcounttextplural' => get_string('users', 'group'),
));
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(friends_control_sideblock())));
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(friends_control_sideblock('find'))));
$smarty->assign('heading', TITLE);
$smarty->assign('users', $data['data']);
$smarty->assign('form', $searchform);
......
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