Skip to content

Commit

Permalink
Added check for ValidateEmail before validating an email in the UserM…
Browse files Browse the repository at this point in the history
…odel.

Added some timestamp synching to inserting a user.
Don't nullify the DateFirstVisit and DateLastActive fields when deleting a user.
  • Loading branch information
tburry committed Sep 15, 2011
1 parent 300a5dd commit 614e6b8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions applications/dashboard/models/class.usermodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ public function Save($FormPostValues, $Settings = FALSE) {
$this->DefineSchema();

// Add & apply any extra validation rules:
if (array_key_exists('Email', $FormPostValues))
if (array_key_exists('Email', $FormPostValues) && GetValue('ValidateEmail', $Settings, TRUE))
$this->Validation->ApplyRule('Email', 'Email');

// Custom Rule: This will make sure that at least one role was selected if saving roles for this user.
Expand Down Expand Up @@ -1409,10 +1409,11 @@ public function AddInsertFields(&$Fields) {
$Fields['HourOffset'] = $HourOffset;
}

// Set some required dates
$Fields[$this->DateInserted] = Gdn_Format::ToDateTime();
$Fields['DateFirstVisit'] = Gdn_Format::ToDateTime();
$Fields['DateLastActive'] = Gdn_Format::ToDateTime();
// Set some required dates.
$Now = Gdn_Format::ToDateTime();
$Fields[$this->DateInserted] = $Now;
$Fields['DateFirstVisit'] = $Now;
$Fields['DateLastActive'] = $Now;
}

/**
Expand Down Expand Up @@ -1666,9 +1667,6 @@ public function Delete($UserID, $Options = array()) {
'Attributes' => Gdn_Format::Serialize(array('State' => 'Deleted')),
'DateSetInvitations' => null,
'DateOfBirth' => null,
'DateFirstVisit' => null,
'DateLastActive' => null,
// 'DateInserted' => '1975-09-16 00:00:00',
'DateUpdated' => Gdn_Format::ToDateTime(),
'HourOffset' => '0',
'Score' => null,
Expand Down

0 comments on commit 614e6b8

Please sign in to comment.