[Cs-project-svn_notify] SF.net SVN: cs-project: [644] trunk/lib
Brought to you by:
crazedsanity
From: <cra...@us...> - 2007-11-20 18:57:50
|
Revision: 644 http://cs-project.svn.sourceforge.net/cs-project/?rev=644&view=rev Author: crazedsanity Date: 2007-11-20 10:57:45 -0800 (Tue, 20 Nov 2007) Log Message: ----------- Fix new user creation problems. /lib/adminUserClass.php: * create_user(): -- store unencrypted password for the "new user" email. -- sends an email to the new user with their username, password, etc. /lib/contactClass.php: * create_contact(): -- no longer creates a copy of itself... (?) -- once the email is created, update the main contact record so the transaction doesn't get aborted at the very end. Modified Paths: -------------- trunk/lib/adminUserClass.php trunk/lib/contactClass.php Modified: trunk/lib/adminUserClass.php =================================================================== --- trunk/lib/adminUserClass.php 2007-11-20 18:32:35 UTC (rev 643) +++ trunk/lib/adminUserClass.php 2007-11-20 18:57:45 UTC (rev 644) @@ -3,11 +3,11 @@ /* * SVN INFORMATION::: * ------------------ - * SVN Signature::::::: $Id$ - * Last Author::::::::: $Author$ - * Current Revision:::: $Revision$ - * Repository Location: $HeadURL$ - * Last Updated:::::::: $Date$ + * SVN Signature::::::: $Id:adminUserClass.php 626 2007-11-20 16:54:11Z crazedsanity $ + * Last Author::::::::: $Author:crazedsanity $ + * Current Revision:::: $Revision:626 $ + * Repository Location: $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/lib/adminUserClass.php $ + * Last Updated:::::::: $Date:2007-11-20 10:54:11 -0600 (Tue, 20 Nov 2007) $ */ class adminUserClass extends userClass { @@ -85,6 +85,7 @@ ); //good to go: encrypt the password. + $originalPassword = $data['password']; $data['password'] = $this->encrypt_pass($data['password'], $contactId); $sql = "INSERT INTO user_table ". string_from_array($data, 'insert', NULL, $cleanStringArr, TRUE, TRUE); @@ -107,6 +108,14 @@ //now add the user to the specified group. $this->add_user_to_group($uid, $data['group_id']); + + //now send an email out to the user to let 'em know. + $templateContents = html_file_to_string('email/new_user.tmpl'); + $repArr = $data; + $repArr['uid'] = $retval; + $repArr['password'] = $originalPassword; + $subject = 'Registration Confirmation ['. $repArr['username'] .']'; + send_email($data['email'], $subject, $templateContents, $repArr); } else { $details = "Created new user (". $data['username'] .") [NEW ID QUERY FAILED, numrows=(". $this->lastNumrows ."), DBERROR::: ". $this->lastError ."]"; Modified: trunk/lib/contactClass.php =================================================================== --- trunk/lib/contactClass.php 2007-11-20 18:32:35 UTC (rev 643) +++ trunk/lib/contactClass.php 2007-11-20 18:57:45 UTC (rev 644) @@ -447,15 +447,24 @@ $retval = $data[0]; //before completing, let's create the primary email address. - $contactObj = new contactClass($this->db); - $contactObj->set_contact_id($retval); - $contactObj->create_contact_email($email, TRUE); - $this->db->commitTrans(); - - //set the internal contactId. $this->set_contact_id($retval); + $contactEmailId = $this->create_contact_email($email, TRUE); - $this->logsObj->log_by_class("Created new contact (". $retval .")"); + //update the contact_email_id on their contact record. + $sql = "UPDATE contact_table SET contact_email_id=". $contactEmailId ." WHERE contact_id=". $retval; + if(is_numeric($contactEmailId) && $this->run_sql($sql)) { + $this->db->commitTrans(); + + //set the internal contactId. + $this->set_contact_id($retval); + + $this->logsObj->log_by_class("Created new contact (". $retval .")"); + } + else { + $this->db->rollbackTrans(); + + $this->logsObj->log_by_class(__METHOD__ .": failed to create email for new contact (". $contactEmailId .")"); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |