php - Moodle login after signup -
i'm trying make first moodle auth extension want confirm , login users directly after signup.
i've changed user_signup function in "email" auth plugin this:
\core\event\user_created::create_from_userid($user->id)->trigger(); $db->set_field("user", "confirmed", 1, array("id"=>$user->id)); $user = get_complete_user_data('username', $username); $db->set_field("user", "firstaccess", time(), array("id"=>$user->id)); $db->set_field("user", "lastlogin", 0, array("id"=>$user->id)); update_user_login_times($user); complete_user_login($user); redirect("$cfg->wwwroot/enrol/index.php?id=2");
it works far user gets signed , confirmed. login following error:
core\session\manager::login_user() must instance of stdclass, boolean given
i might acting stupid here, don't know how login new user here. apprechiated. thanks!
after creating user account username , password have entered , implement this.
if ($user = authenticate_user_login($username, $password)) { /// let's them set up. complete_user_login($user); redirect($cfg->wwwroot . 'url want'); }
Comments
Post a Comment