Commit 8dcf8e5e authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Fixed "removing a friend"

parent 7b2c8eb9
......@@ -53,7 +53,7 @@ if ($control) {
json_reply(true, $e->getMessage());
}
$user = get_record('usr', 'id', $values['id']);
friend_submit($values);
friend_submit(null, $values);
exit;
}
......
......@@ -481,7 +481,7 @@ function suspend_user($suspendeduserid, $reason, $suspendinguserid=null) {
* handle the add/remove/approve/reject friend form
* @param array $values from pieforms.
*/
function friend_submit(Pieform $form, $values) {
function friend_submit($form, $values) {
global $user, $USER;
log_debug($values);
......@@ -556,7 +556,13 @@ function friend_submit(Pieform $form, $values) {
break;
}
activity_occurred('maharamessage', $n);
$form->json_reply(PIEFORM_OK, get_string('friendform' . $values['type'] . 'success', 'mahara', display_name($user)));
if ($form instanceof Pieform) {
$form->json_reply(PIEFORM_OK, get_string('friendform' . $values['type'] . 'success', 'mahara', display_name($user)));
}
else {
json_reply(false, get_string('friendform' . $values['type'] . 'success', 'mahara', display_name($user)));
}
}
/**
......
Supports Markdown
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