Login as newly created user

Permalink
I want to allow some users to make new users. I've gotten this to work, but now I want the "managing" user to log in as the user they create, if they opt to. I've added a checkbox, and when it's checked and submitted, i am doing:

$u->loginByUserID($user->getUserID());
                header('https://www.fake.com/firstlogin');


This doesn't work. I get a popup window to learn the basics of concrete5. The user DOES get logged in, but I am not being pushed to the right page. I added a
die();
after but this gave me a blank page.

Complete code below in case I am messing something up. Sorry for it being so messy.

<?php
    use Concrete\Core\User\User;
    $u = new user();
    $ui = UserInfo::getByID($u->getUserID()); 
    $semail = $ui->getUserEmail();
    if(isset($_GET['email']) && !empty($_GET['email'])){
        $email = $_GET['email'];
        $usercheck = UserInfo::getByEmail($email);
        if(!empty($usercheck)) {
            echo "<span style='color:red;'>Email exists.  Please select another.</span>";
        } else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            echo "<span style='color:red;'>Invalid email.</span>";
        } else {
            $uname = $_GET['firstname'] . $_GET['lastname'];
            $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";

GeeEM
View Replies: