original_string: public function user_signup_with_confirmation($user, $notify=true, $confirmationurl = null) {
          global $CFG, $DB, $SESSION;
          require_once($CFG->dirroot.'/user/profile/lib.php');
          require_once($CFG->dirroot.'/user/lib.php');
  
          $plainpassword = $user->password;
          $user->password = hash_internal_user_password($user->password);
          if (empty($user->calendartype)) {
              $user->calendartype = $CFG->calendartype;
          }
  
          $user->id = user_create_user($user, false, false);
  
          user_add_password_history($user->id, $plainpassword);
  
          // Save any custom profile field information.
          profile_save_data($user);
  
          // Save wantsurl against user's profile, so we can return them there upon confirmation.
          if (!empty($SESSION->wantsurl)) {
              set_user_preference('auth_email_wantsurl', $SESSION->wantsurl, $user);
          }
  
          // Trigger event.
          \core\event\user_created::create_from_userid($user->id)->trigger();
  
          if (! send_confirmation_email($user, $confirmationurl)) {
              print_error('auth_emailnoemail', 'auth_email');
          }
  
          if ($notify) {
              global $CFG, $PAGE, $OUTPUT;
              $emailconfirm = get_string('emailconfirm');
              $PAGE->navbar->add($emailconfirm);
              $PAGE->set_title($emailconfirm);
              $PAGE->set_heading($PAGE->course->fullname);
              echo $OUTPUT->header();
              notice(get_string('emailconfirmsent', '', $user->email), "$CFG->wwwroot/index.php");
          } else {
              return true;
          }
      }
code: public function user_signup_with_confirmation($user, $notify=true, $confirmationurl = null) {
          global $CFG, $DB, $SESSION;
          require_once($CFG->dirroot.'/user/profile/lib.php');
          require_once($CFG->dirroot.'/user/lib.php');
  
          $plainpassword = $user->password;
          $user->password = hash_internal_user_password($user->password);
          if (empty($user->calendartype)) {
              $user->calendartype = $CFG->calendartype;
          }
  
          $user->id = user_create_user($user, false, false);
  
          user_add_password_history($user->id, $plainpassword);
  
          // Save any custom profile field information.
          profile_save_data($user);
  
          // Save wantsurl against user's profile, so we can return them there upon confirmation.
          if (!empty($SESSION->wantsurl)) {
              set_user_preference('auth_email_wantsurl', $SESSION->wantsurl, $user);
          }
  
          // Trigger event.
          \core\event\user_created::create_from_userid($user->id)->trigger();
  
          if (! send_confirmation_email($user, $confirmationurl)) {
              print_error('auth_emailnoemail', 'auth_email');
          }
  
          if ($notify) {
              global $CFG, $PAGE, $OUTPUT;
              $emailconfirm = get_string('emailconfirm');
              $PAGE->navbar->add($emailconfirm);
              $PAGE->set_title($emailconfirm);
              $PAGE->set_heading($PAGE->course->fullname);
              echo $OUTPUT->header();
              notice(get_string('emailconfirmsent', '', $user->email), "$CFG->wwwroot/index.php");
          } else {
              return true;
          }
      }
code_tokens: public function user_signup_with_confirmation ( $ user , $ notify = true , $ confirmationurl = null ) { global $ CFG , $ DB , $ SESSION ; require_once ( $ CFG -> dirroot . '/user/profile/lib.php' ) ; require_once ( $ CFG -> dirroot . '/user/lib.php' ) ; $ plainpassword = $ user -> password ; $ user -> password = hash_internal_user_password ( $ user -> password ) ; if ( empty ( $ user -> calendartype ) ) { $ user -> calendartype = $ CFG -> calendartype ; } $ user -> id = user_create_user ( $ user , false , false ) ; user_add_password_history ( $ user -> id , $ plainpassword ) ; // Save any custom profile field information. profile_save_data ( $ user ) ; // Save wantsurl against user's profile, so we can return them there upon confirmation. if ( ! empty ( $ SESSION -> wantsurl ) ) { set_user_preference ( 'auth_email_wantsurl' , $ SESSION -> wantsurl , $ user ) ; } // Trigger event. \ core \ event \ user_created :: create_from_userid ( $ user -> id ) -> trigger ( ) ; if ( ! send_confirmation_email ( $ user , $ confirmationurl ) ) { print_error ( 'auth_emailnoemail' , 'auth_email' ) ; } if ( $ notify ) { global $ CFG , $ PAGE , $ OUTPUT ; $ emailconfirm = get_string ( 'emailconfirm' ) ; $ PAGE -> navbar -> add ( $ emailconfirm ) ; $ PAGE -> set_title ( $ emailconfirm ) ; $ PAGE -> set_heading ( $ PAGE -> course -> fullname ) ; echo $ OUTPUT -> header ( ) ; notice ( get_string ( 'emailconfirmsent' , '' , $ user -> email ) , "$CFG->wwwroot/index.php" ) ; } else { return true ; } }
docstring: Sign up a new user ready for confirmation.
  
  Password is passed in plaintext.
  A custom confirmationurl could be used.
  
  @param object $user new user object
  @param boolean $notify print notice with link and terminate
  @param string $confirmationurl user confirmation URL
  @return boolean true if everything well ok and $notify is set to true
  @throws moodle_exception
  @since Moodle 3.2
docstring_tokens: Sign up a new user ready for confirmation .