Commit b385e0da authored by Paul Holden's avatar Paul Holden
Browse files

MDL-73603 webservice: fix user retrieval in token form callback.

parent 0e188470
......@@ -25,6 +25,8 @@
namespace core_webservice;
use core_user;
/**
* Form to create and edit a web service token.
*
......@@ -52,11 +54,11 @@ class token_form extends \moodleform {
'multiple' => false,
'ajax' => 'core_user/form_user_selector',
'valuehtmlcallback' => function($userid) {
global $DB, $OUTPUT;
global $OUTPUT;
$context = \context_system::instance();
$fields = \core_user\fields::for_name()->with_identity($context, false);
$record = $DB->get_record('user', ['id' => $userid], $fields, MUST_EXIST);
$record = core_user::get_user($userid, 'id ' . $fields->get_sql()->selects, MUST_EXIST);
$user = (object)[
'id' => $record->id,
......
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