Sign up confirmation not proper login (answered)

Sign up confirmation not proper login (answered)

by oliver stearn -
Number of replies: 0

We have had a problem for a while, where a cohort based enrolment plugin only enrols students on a proper login, i.e. not when they click the link in the sign up confirmation email. I have ignored it until now as the client seems perfectly happy advising students to log out and log back in to gain access to their courses. 

This was exacerbated earlier this week, as I developed a plugin which 'activates' user accounts. Users start with a locked & hidden profile field called 'activated' which is 0 by default. If they enter a code, or purchase a certain course with paypal, that field is set to 1 and they are never bothered to activate again. 

The only thing is that it seems that the profile field entry in user_field_data is only created on a proper login too.

Anyway, I don't believe there is a setting to not log in students when they confirm their email address, so I commented a couple of lines out of /login/confirm.php to confirm the account without logging them in. Perhaps it will be useful for someone else too. 

The line that needs commenting out is line 79 on moodle 3.6:

        if (!$user->suspended) {

            // complete_user_login($user);

Obviously not good practice to comment out core code, but there you go. 

Average of ratings: -