Activation Emails

Started by jbooker, January 10, 2008, 12:02:38 PM

Previous topic - Next topic

jbooker

Just wanted to share some changes I made to the account activation code...

I was having a problem with the email setup on my server, so the account activation emails weren't being delivered. I had logged in periodically and activated the waiting accounts, without really having anyidea if the users had a valid email address or not.

In the end, I decided I'd like to de-activate all the accounts on my forum and let the uses re-activate as they visit the forum. The idea was to run something like "UPDATE smf_members SET is_activated = 0"... However, this caused the users to get emails with a blank 'validation_code'.

I added the following code to generate a new validation code in the case that is_activated == 0 and the validation_code is blank.

In Sources/Registration.php, function Activate(), just after the first call to 'mysql_free_result'


// ugly hack to reset the validation code if it's blank
    if($row['validation_code'] == '' && $row['is_activated'] == 0){
               
        $validation_code = substr(preg_replace('/\W/', '', md5(rand())), 0, 10);

        updateMemberData($row['ID_MEMBER'], array('validation_code'=> ("'".$validation_code . "'")));

        $row['validation_code'] = $validation_code;
    }


Hope that helps somebody else, or makes it into a future release...

p.s. I googled and forum searched for info on submitting patches to the core, but only found stuff on making modules. I realize this isn't the best way to submit code, but it's all I could find.

Advertisement: