本文整理汇总了PHP中get_complete_user_data函数的典型用法代码示例。如果您正苦于以下问题:PHP get_complete_user_data函数的具体用法?PHP get_complete_user_data怎么用?PHP get_complete_user_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_complete_user_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_content
public function get_content()
{
global $COURSE, $USER;
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass();
$this->content->text = var_export($this->context, true);
$coursecontext = context_course::instance($COURSE->id);
if (has_capability('block/demostudent:addinstance', $coursecontext)) {
// If DemoStudent has not yet been enrolled, allow user to create/enrol one.
$demostudentusername = generate_demostudent_name($USER->username);
$demostudentuser = get_complete_user_data('username', $demostudentusername);
if (!$demostudentuser || !is_enrolled($coursecontext, $demostudentuser)) {
$this->render_view('firstuse');
} else {
$this->render_view('instructor');
}
} else {
if (has_capability('block/demostudent:seedemostudentblock', $coursecontext)) {
$this->render_view('demostudent');
} else {
// If the user does not need to see the block, do not display it at all.
$this->content->text = '';
$this->content->footer = '';
}
}
return $this->content;
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:29,代码来源:block_demostudent.php
示例2: user_update_password
/**
* Updates the user's password.
*
* called when the user password is updated.
*
* @param object $user User table object
* @param string $newpassword Plaintext password
* @return boolean result
*
*/
function user_update_password($user, $newpassword)
{
$user = get_complete_user_data('id', $user->id);
// This will also update the stored hash to the latest algorithm
// if the existing hash is using an out-of-date algorithm (or the
// legacy md5 algorithm).
return update_internal_user_password($user, $newpassword);
}
开发者ID:evltuma,项目名称:moodle,代码行数:18,代码来源:auth.php
示例3: get_info_for_enrolment_change
/**
* Return user info for this event.
*/
private function get_info_for_enrolment_change($panopto, $relateduserid, $contextid)
{
global $DB;
// DB userkey is "[instancename]\\[username]". Get username and use it to create key.
$user = get_complete_user_data('id', $relateduserid);
$username = $user->username;
$userkey = $panopto->panopto_decorate_username($username);
// Get contextID to determine user's role.
$role = $this->get_role_from_context($contextid, $relateduserid);
return array("role" => $role, "userkey" => $userkey);
}
开发者ID:hitteshahuja,项目名称:Moodle-2.0-plugin-for-Panopto,代码行数:14,代码来源:update_user.php
示例4: validation
function validation($data, $files)
{
$errors = parent::validation($data, $files);
// Ensure we don't miss errors from any higher-level validation
// Do our own validation and add errors to array
foreach ($data as $key => $value) {
if ($key == 'username') {
$user = get_complete_user_data('username', $value);
if ($user === false) {
$errors[$key] = get_string('user_not_found', 'local_obu_forms');
}
}
}
return $errors;
}
开发者ID:OBU-OBIS,项目名称:moodle-local_obu_forms,代码行数:15,代码来源:user_input.php
示例5: verify_code
public static function verify_code($code)
{
global $DB;
//Parameter validation
//REQUIRED
$params = self::validate_parameters(self::verify_code_parameters(), array('code' => $code));
$code = trim($params['code']);
if (empty($code)) {
throw new invalid_parameter_exception('Empty code');
}
if (!($issuecert = $DB->get_record('simplecertificate_issues', array('code' => $code)))) {
throw new invalid_parameter_exception('Invalid code');
}
if (!($user = get_complete_user_data('id', $issuecert->userid))) {
throw new moodle_exception('cannotfinduser', 'error', null, '');
}
return fullname($user);
}
开发者ID:v--k,项目名称:moodle-mod_simplecertificate,代码行数:18,代码来源:externallib.php
示例6: validation
function validation($data)
{
global $CFG;
$errors = array();
if (!empty($data['username']) and !empty($data['email']) or empty($data['username']) and empty($data['email'])) {
$errors['username'] = get_string('usernameoremail');
$errors['email'] = get_string('usernameoremail');
} else {
if (!empty($data['email'])) {
if (!validate_email($data['email'])) {
$errors['email'] = get_string('invalidemail');
} else {
if (count_records('user', 'email', $data['email']) > 1) {
$errors['email'] = get_string('forgottenduplicate');
} else {
if ($user = get_complete_user_data('email', $data['email'])) {
if (empty($user->confirmed)) {
$errors['email'] = get_string('confirmednot');
}
}
if (!$user and empty($CFG->protectusernames)) {
$errors['email'] = get_string('emailnotfound');
}
}
}
} else {
if ($user = get_complete_user_data('username', $data['username'])) {
if (empty($user->confirmed)) {
$errors['email'] = get_string('confirmednot');
}
}
if (!$user and empty($CFG->protectusernames)) {
$errors['username'] = get_string('usernamenotfound');
}
}
}
if (0 == count($errors)) {
return true;
} else {
return $errors;
}
}
开发者ID:veritech,项目名称:pare-project,代码行数:42,代码来源:forgot_password_form.php
示例7: signature
public function signature($course, $user_id, $show_assessor)
{
$user = get_complete_user_data('id', $user_id);
$output = html_writer::start_tag('div', array('class' => 'marksheet-sign'));
if ($user) {
$output .= html_writer::start_tag('div', array('class' => 'student-info'));
$output .= html_writer::tag('h4', 'Participant’s Full Name: ' . $user->firstname . ' ' . $user->lastname);
$output .= html_writer::tag('h4', 'Participant’s ID: ' . $user->alternatename);
$output .= html_writer::end_tag('div');
}
if ($show_assessor) {
$output .= html_writer::start_tag('div', array('class' => 'assessor-info'));
$output .= html_writer::tag('h4', 'Assessors Name: ______________________________ ');
$output .= html_writer::tag('h4', 'Assessor’s Signature: ______________________________ ');
$output .= html_writer::tag('h4', 'Date: _____/_____/__________ ');
$output .= html_writer::end_tag('div');
}
$output .= html_writer::end_tag('div');
return $output;
}
开发者ID:abhiahirwar,项目名称:moodle_plugin,代码行数:20,代码来源:renderer.php
示例8: validation
function validation($data, $files) {
global $CFG, $DB;
$errors = parent::validation($data, $files);
if ((!empty($data['username']) and !empty($data['email'])) or (empty($data['username']) and empty($data['email']))) {
$errors['username'] = get_string('usernameoremail');
$errors['email'] = get_string('usernameoremail');
} else if (!empty($data['email'])) {
if (!validate_email($data['email'])) {
$errors['email'] = get_string('invalidemail');
} else if ($DB->count_records('user', array('email'=>$data['email'])) > 1) {
$errors['email'] = get_string('forgottenduplicate');
} else {
if ($user = get_complete_user_data('email', $data['email'])) {
if (empty($user->confirmed)) {
$errors['email'] = get_string('confirmednot');
}
}
if (!$user and empty($CFG->protectusernames)) {
$errors['email'] = get_string('emailnotfound');
}
}
} else {
if ($user = get_complete_user_data('username', $data['username'])) {
if (empty($user->confirmed)) {
$errors['email'] = get_string('confirmednot');
}
}
if (!$user and empty($CFG->protectusernames)) {
$errors['username'] = get_string('usernamenotfound');
}
}
return $errors;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:40,代码来源:forgot_password_form.php
示例9: xmldb_block_repository_upgrade
function xmldb_block_repository_upgrade($oldversion = 0)
{
$result = true;
if ($oldversion < 2010090901) {
$errors = false;
$auths = block_repository_nopasswd_auths();
$authlist = "'" . implode("', '", $auths) . "'";
$users = get_records_select('user', "auth IN ({$authlist})", '', 'id, auth');
if (!empty($users)) {
foreach ($users as $user) {
$user = get_complete_user_data('id', $user->id);
$migrate_ok = block_repository_user_created($user);
if (!$migrate_ok) {
$errors = true;
error_log("xmldb_block_repository_upgrade({$oldversion}) - failed migrating user ({$user->id}) to Alfresco.");
}
}
}
if (!$errors) {
set_config('initialized', 1, repository_plugin_alfresco::$plugin_name);
}
}
return $result;
}
开发者ID:remotelearner,项目名称:elis.alfresco,代码行数:24,代码来源:upgrade.php
示例10: require_login
require_once './locallib.php';
require_once './mdl_redirect_form.php';
require_login();
$context = context_system::instance();
require_capability('local/obu_application:manage', $context);
// We only handle an existing application (id given)
if (isset($_REQUEST['id'])) {
$application_id = $_REQUEST['id'];
} else {
echo get_string('invalid_data', 'local_obu_application');
die;
}
// We may have been given the email of the new approver
if (isset($_REQUEST['approver_email'])) {
$approver_email = $_REQUEST['approver_email'];
$approver = get_complete_user_data('email', $approver_email);
if ($approver) {
$approver_name = $approver->firstname . ' ' . $approver->lastname;
} else {
$approver_name = 'Not Registered';
}
} else {
$approver_email = '';
$approver_name = '';
}
$home = new moodle_url('/');
$dir = $home . 'local/obu_application/';
$program = $dir . 'mdl_redirect.php?id=' . $application_id;
$heading = get_string('redirect_application', 'local_obu_application');
$PAGE->set_context($context);
$PAGE->set_pagelayout('standard');
开发者ID:OBU-OBIS,项目名称:moodle-local_obu_application,代码行数:31,代码来源:mdl_redirect.php
示例11: session_loginas
/**
* Login as another user - no security checks here.
* @param int $userid
* @param stdClass $context
* @return void
*/
function session_loginas($userid, $context)
{
if (session_is_loggedinas()) {
return;
}
// switch to fresh new $SESSION
$_SESSION['REALSESSION'] = $_SESSION['SESSION'];
$_SESSION['SESSION'] = new stdClass();
/// Create the new $USER object with all details and reload needed capabilities
$_SESSION['REALUSER'] = $_SESSION['USER'];
$user = get_complete_user_data('id', $userid);
$user->realuser = $_SESSION['REALUSER']->id;
$user->loginascontext = $context;
// let enrol plugins deal with new enrolments if necessary
enrol_check_plugins($user);
// set up global $USER
session_set_user($user);
}
开发者ID:neogic,项目名称:moodle,代码行数:24,代码来源:sessionlib.php
示例12: print_error
print_error("Info received. Finishing authentication process through regular method hook because no SAML response detected.");
display_object($_POST);
$USER = authenticate_user_login($saml_user[$saml_account_matcher], time());
}
// check that the signin worked
if ($USER == false) {
print_error("You could not be identified or created. <br />Login result: FAILURE<br />I have...<br />" . htmlspecialchars(print_r($USER, true)));
session_write_close();
$USER = new object();
$USER->id = 0;
require_once '../../config.php';
print_error('pluginauthfailed', 'auth_onelogin_saml', '', !empty($saml_user['username']) ? $saml_user['username'] : $saml_user['email']);
}
// complete the user login sequence
$USER->loggedin = true;
$USER->site = $CFG->wwwroot;
$USER = get_complete_user_data('id', $USER->id);
complete_user_login($USER);
// flag this as a SAML based login
$SESSION->isSAMLSessionControlled = true;
if (isset($wantsurl)) {
// and (strpos($wantsurl, $CFG->wwwroot) === 0)
$urltogo = clean_param($wantsurl, PARAM_URL);
} else {
$urltogo = $CFG->wwwroot . '/';
}
if (!$urltogo || $urltogo == "") {
$urltogo = $CFG->wwwroot . '/';
}
unset($SESSION->wantsurl);
redirect($urltogo, 0);
开发者ID:mfprimo,项目名称:moodle-onelogin,代码行数:31,代码来源:index.php
示例13: get_complete_user_data
}
$confirmed = $authplugin->user_confirm($username, $usersecret);
if ($confirmed == AUTH_CONFIRM_ALREADY) {
$user = get_complete_user_data('username', $username);
print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), array(), "");
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
echo "<h3>" . get_string("thanks") . ", " . fullname($user) . "</h3>\n";
echo "<p>" . get_string("alreadyconfirmed") . "</p>\n";
echo $OUTPUT->button(html_form::make_button("{$CFG->wwwroot}/course/", null, get_string('courses')));
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
exit;
} else {
if ($confirmed == AUTH_CONFIRM_OK) {
// The user has confirmed successfully, let's log them in
if (!($user = get_complete_user_data('username', $username))) {
print_error('cannotfinduser', '', '', $username);
}
complete_user_login($user);
if (!empty($SESSION->wantsurl)) {
// Send them where they were going
$goto = $SESSION->wantsurl;
unset($SESSION->wantsurl);
redirect($goto);
}
print_header(get_string("confirmed"), get_string("confirmed"), array(), "");
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
echo "<h3>" . get_string("thanks") . ", " . fullname($USER) . "</h3>\n";
echo "<p>" . get_string("confirmed") . "</p>\n";
echo $OUTPUT->button(html_form::make_button("{$CFG->wwwroot}/course/", null, get_string('courses')));
echo $OUTPUT->box_end();
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:confirm.php
示例14: authenticate_user_login
/**
* Authenticates a user against the chosen authentication mechanism
*
* Given a username and password, this function looks them
* up using the currently selected authentication mechanism,
* and if the authentication is successful, it returns a
* valid $user object from the 'user' table.
*
* Uses auth_ functions from the currently active auth module
*
* After authenticate_user_login() returns success, you will need to
* log that the user has logged in, and call complete_user_login() to set
* the session up.
*
* Note: this function works only with non-mnet accounts!
*
* @param string $username User's username (or also email if $CFG->authloginviaemail enabled)
* @param string $password User's password
* @param bool $ignorelockout useful when guessing is prevented by other mechanism such as captcha or SSO
* @param int $failurereason login failure reason, can be used in renderers (it may disclose if account exists)
* @return stdClass|false A {@link $USER} object or false if error
*/
function authenticate_user_login($username, $password, $ignorelockout = false, &$failurereason = null)
{
global $CFG, $DB;
require_once "{$CFG->libdir}/authlib.php";
if ($user = get_complete_user_data('username', $username, $CFG->mnet_localhost_id)) {
// we have found the user
} else {
if (!empty($CFG->authloginviaemail)) {
if ($email = clean_param($username, PARAM_EMAIL)) {
$select = "mnethostid = :mnethostid AND LOWER(email) = LOWER(:email) AND deleted = 0";
$params = array('mnethostid' => $CFG->mnet_localhost_id, 'email' => $email);
$users = $DB->get_records_select('user', $select, $params, 'id', 'id', 0, 2);
if (count($users) === 1) {
// Use email for login only if unique.
$user = reset($users);
$user = get_complete_user_data('id', $user->id);
$username = $user->username;
}
unset($users);
}
}
}
$authsenabled = get_enabled_auth_plugins();
if ($user) {
// Use manual if auth not set.
$auth = empty($user->auth) ? 'manual' : $user->auth;
if (in_array($user->auth, $authsenabled)) {
$authplugin = get_auth_plugin($user->auth);
$authplugin->pre_user_login_hook($user);
}
if (!empty($user->suspended)) {
$failurereason = AUTH_LOGIN_SUSPENDED;
// Trigger login failed event.
$event = \core\event\user_login_failed::create(array('userid' => $user->id, 'other' => array('username' => $username, 'reason' => $failurereason)));
$event->trigger();
error_log('[client ' . getremoteaddr() . "] {$CFG->wwwroot} Suspended Login: {$username} " . $_SERVER['HTTP_USER_AGENT']);
return false;
}
if ($auth == 'nologin' or !is_enabled_auth($auth)) {
// Legacy way to suspend user.
$failurereason = AUTH_LOGIN_SUSPENDED;
// Trigger login failed event.
$event = \core\event\user_login_failed::create(array('userid' => $user->id, 'other' => array('username' => $username, 'reason' => $failurereason)));
$event->trigger();
error_log('[client ' . getremoteaddr() . "] {$CFG->wwwroot} Disabled Login: {$username} " . $_SERVER['HTTP_USER_AGENT']);
return false;
}
$auths = array($auth);
} else {
// Check if there's a deleted record (cheaply), this should not happen because we mangle usernames in delete_user().
if ($DB->get_field('user', 'id', array('username' => $username, 'mnethostid' => $CFG->mnet_localhost_id, 'deleted' => 1))) {
$failurereason = AUTH_LOGIN_NOUSER;
// Trigger login failed event.
$event = \core\event\user_login_failed::create(array('other' => array('username' => $username, 'reason' => $failurereason)));
$event->trigger();
error_log('[client ' . getremoteaddr() . "] {$CFG->wwwroot} Deleted Login: {$username} " . $_SERVER['HTTP_USER_AGENT']);
return false;
}
// User does not exist.
$auths = $authsenabled;
$user = new stdClass();
$user->id = 0;
}
if ($ignorelockout) {
// Some other mechanism protects against brute force password guessing, for example login form might include reCAPTCHA
// or this function is called from a SSO script.
} else {
if ($user->id) {
// Verify login lockout after other ways that may prevent user login.
if (login_is_lockedout($user)) {
$failurereason = AUTH_LOGIN_LOCKOUT;
// Trigger login failed event.
$event = \core\event\user_login_failed::create(array('userid' => $user->id, 'other' => array('username' => $username, 'reason' => $failurereason)));
$event->trigger();
error_log('[client ' . getremoteaddr() . "] {$CFG->wwwroot} Login lockout: {$username} " . $_SERVER['HTTP_USER_AGENT']);
return false;
}
} else {
//.........这里部分代码省略.........
开发者ID:lucaboesch,项目名称:moodle,代码行数:101,代码来源:moodlelib.php
示例15: optional_param
$sessionstarted = optional_param('sessionstarted', 0, PARAM_BOOL);
if (!$sessionstarted) {
redirect("index.php?sessionstarted=1&lang={$CFG->lang}");
} else {
$sessionverify = optional_param('sessionverify', 0, PARAM_BOOL);
if (!$sessionverify) {
$SESSION->sessionverify = 1;
redirect("index.php?sessionstarted=1&sessionverify=1&lang={$CFG->lang}");
} else {
if (empty($SESSION->sessionverify)) {
print_error('installsessionerror', 'admin', "index.php?sessionstarted=1&lang={$CFG->lang}");
}
unset($SESSION->sessionverify);
}
}
$adminuser = get_complete_user_data('username', 'admin');
if ($adminuser->password === 'adminsetuppending') {
// prevent installation hijacking
if ($adminuser->lastip !== getremoteaddr()) {
print_error('installhijacked', 'admin');
}
// login user and let him set password and admin details
$adminuser->newadminuser = 1;
message_set_default_message_preferences($adminuser);
complete_user_login($adminuser, false);
redirect("{$CFG->wwwroot}/user/editadvanced.php?id={$adminuser->id}");
// Edit thyself
} else {
unset_config('adminsetuppending');
}
} else {
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:index.php
示例16: optional_param
}
$token = optional_param('token', '', PARAM_TEXT);
$tab = optional_param('tab', simplecertificate::DEFAULT_VIEW, PARAM_INT);
$sort = optional_param('sort', '', PARAM_RAW);
$type = optional_param('type', '', PARAM_ALPHA);
$page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', get_config('simplecertificate', 'perpage'), PARAM_INT);
$issuelist = optional_param('issuelist', null, PARAM_ALPHA);
$username = optional_param('username', '', PARAM_TEXT);
$username = strtolower($username);
$auth = new auth_plugin_joomdle();
$logged = $auth->call_method("confirmJoomlaSession", $username, $token);
if (!$logged) {
return;
}
$USER = get_complete_user_data('username', $username);
complete_user_login($USER);
$context = context_module::instance($cm->id);
require_capability('mod/simplecertificate:view', $context);
$canmanage = has_capability('mod/simplecertificate:manage', $context);
$url = new moodle_url('/mod/simplecertificate/view.php', array('id' => $cm->id, 'tab' => $tab, 'page' => $page, 'perpage' => $perpage));
if ($type) {
$url->param('type', $type);
}
if ($sort) {
$url->param('sort', $sort);
}
if ($action) {
$url->param('action', $action);
}
if ($issuelist) {
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:31,代码来源:simplecertificate_view.php
示例17: array
$PAGE->set_url('/blocks/demostudent/remove.php', array('viewrole' => $viewrole, 'courseid' => $courseid, 'confirm' => $confirm));
$coursecontext = context_course::instance($courseid);
if ($viewrole != 'instructor') {
print get_string('errorremovenotinstructor', 'block_demostudent');
require_logout();
redirect(new moodle_url($url, array('redirect' => 1)));
}
// If we do not have the capability to add this block, we likely landed here by accident or malice.
if (!has_capability('block/demostudent:addinstance', $coursecontext)) {
// Test this as above, but start from a student account instead of DemoStudent.
print get_string('errormissingaddinstancecapability', 'block_demostudent');
require_logout();
redirect(new moodle_url($url, array('redirect' => 1)));
}
$demostudentusername = generate_demostudent_name($username);
$demostudentuser = get_complete_user_data('username', $demostudentusername);
if (!$demostudentuser) {
redirect(new moodle_url($url, array('redirect' => 1)));
}
if ($confirm) {
// Unenrol DemoStudent from the course.
if (!enrol_is_enabled('manual')) {
redirect(new moodle_url($url, array('redirect' => 1)));
}
if (!($enrol = enrol_get_plugin('manual'))) {
redirect(new moodle_url($url, array('redirect' => 1)));
}
if (!($instances = $DB->get_records('enrol', array('enrol' => 'manual', 'courseid' => $courseid, 'status' => ENROL_INSTANCE_ENABLED), 'sortorder,id ASC'))) {
redirect(new moodle_url($url, array('redirect' => 1)));
}
$instance = reset($instances);
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:31,代码来源:remove.php
示例18: moodle_setlocale
if (empty($SESSION->lang)) {
$CFG->lang = 'en';
} else {
$CFG->lang = $SESSION->lang;
}
}
// Set the default site locale, a lot of the stuff may depend on this
// it is definitely too late to call this first in require_login()!
moodle_setlocale();
if (!empty($CFG->debugvalidators) and !empty($CFG->guestloginbutton)) {
if ($CFG->theme == 'standard' or $CFG->theme == 'standardwhite') {
// Temporary measure to help with XHTML validation
if (isset($_SERVER['HTTP_USER_AGENT']) and empty($USER->id)) {
// Allow W3CValidator in as user called w3cvalidator (or guest)
if (strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false or strpos($_SERVER['HTTP_USER_AGENT'], 'Cynthia') !== false) {
if ($user = get_complete_user_data("username", "w3cvalidator")) {
$user->ignoresesskey = true;
} else {
$user = guest_user();
}
session_set_user($user);
}
}
}
}
// Apache log integration. In apache conf file one can use ${MOODULEUSER}n in
// LogFormat to get the current logged in username in moodle.
if ($USER && function_exists('apache_note') && !empty($CFG->apacheloguser) && isset($USER->username)) {
$apachelog_userid = $USER->id;
$apachelog_username = clean_filename($USER->username);
$apachelog_name = '';
开发者ID:hatone,项目名称:moodle,代码行数:31,代码来源:setup.php
示例19: print_error
print_error('fail_match_secret', 'auth_openid');
}
break;
// If the user's account is confirmed, set the secret to a random value and send
// an email to the user - unless it's already set (in which case, send a
// duplicate message)
// If the user's account is confirmed, set the secret to a random value and send
// an email to the user - unless it's already set (in which case, send a
// duplicate message)
case 'send_message':
if (!confirm_sesskey()) {
print_error('auth_openid_bad_session_key', 'auth_openid');
}
if (!empty($url)) {
$userid = get_field('openid_urls', 'userid', 'url', $url);
$user = get_complete_user_data('id', $userid);
if (!$user || !$user->confirmed) {
print_error('user_not_found', 'auth_openid');
} else {
// Create a secret in the database
if (empty($user->secret)) {
$secret = random_string(15);
set_field('user', 'secret', $secret, 'id', $user->id);
$user->secret = $secret;
}
openid_send_fallback_email($user, $url);
$redirmsg = get_string('fallback_message_sent', 'auth_openid');
break;
}
}
// Any other case, just display the fallback form
开发者ID:remotelearner,项目名称:elis.openid,代码行数:31,代码来源:fallback.php
示例20: getremoteaddr
$newuser->firstname = $firstname;
$newuser->lastname = $lastname;
$newuser->email = $email;
if (empty($newuser->lang) || !get_string_manager()->translation_exists($newuser->lang)) {
$newuser->lang = $CFG->lang;
}
$newuser->confirmed = 1;
// don't want an email going out about this user
$newuser->lastip = getremoteaddr();
$newuser->timecreated = time();
$newuser->timemodified = $newuser->timecreated;
$newuser->mnethostid = $CFG->mnet_localhost_id;
// make sure we haven't exceeded any field limits
$newuser = truncate_user($newuser);
$newuser->id = $DB->insert_record('user', $newuser);
$user = get_complete_user_data('id', $newuser->id);
\core\event\user_created::create_from_userid($user->id)->trigger();
}
}
// if we can find a cohortid matching what we sent in, enrol this user in that cohort by adding a record to cohort_members
if (!empty($cohort)) {
$ids = explode(',', $cohort);
foreach ($ids as $cohort) {
if ($DB->record_exists('cohort', array('idnumber' => $cohort))) {
$cohortrow = $DB->get_record('cohort', array('idnumber' => $cohort));
if (!$DB->record_exists('cohort_members', array('cohortid' => $cohortrow->id, 'userid' => $user->id))) {
// internally triggers cohort_member_added event
cohort_add_member($cohortrow->id, $user->id);
}
// if the plugin auto-opens the course, then find the course this cohort enrols for and set it as the opener link
if (get_config('auth/wp2moodle', 'autoopen') == 'yes') {
开发者ID:nagyistoce,项目名称:wp2moodle-moodle,代码行数:31,代码来源:login.php
注:本文中的get_complete_user_data函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论