Skip to content

Commit

Permalink
v0.6.00
Browse files Browse the repository at this point in the history
  • Loading branch information
rossdotparker committed Nov 5, 2019
1 parent 1860471 commit 9842de3
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
5 changes: 5 additions & 0 deletions Alumni/CHANGEDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@
++$count;
$sql[$count][0] = '0.5.00';
$sql[$count][1] = '';

//v0.6.00
++$count;
$sql[$count][0] = '0.6.00';
$sql[$count][1] = '';
4 changes: 4 additions & 0 deletions Alumni/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
CHANGELOG
=========
v0.6.00
-------
Email uniqueness check on public registration

v0.5.00
-------
Gibbon Core v17 compatibility
Expand Down
2 changes: 1 addition & 1 deletion Alumni/manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$entryURL = 'alumni_manage.php';
$type = 'Additional';
$category = 'People';
$version = '0.5.00';
$version = '0.6.00';
$author = 'Ross Parker';
$url = 'http://rossparker.org/free-learning';

Expand Down
5 changes: 3 additions & 2 deletions Alumni/publicRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

$returns = array();
$returns['error5'] = sprintf(__('Your request failed because you do not meet the minimum age for joining this site (%1$s years of age).'), $publicRegistrationMinimumAge);
$returns['error7'] = __('Your request failed because the specified email address has already been registered');
$returns['success0'] = __('Your registration was successfully submitted: a member of our alumni team will be in touch shortly.');
$editLink = '';
if (isset($_GET['editID'])) {
Expand Down Expand Up @@ -75,7 +76,7 @@
$row = $form->addRow();
$row->addLabel('firstName', __('First Name'));
$row->addTextField('firstName')->isRequired()->maxLength(30);

$row = $form->addRow();
$row->addLabel('surname', __('Surname'));
$row->addTextField('surname')->isRequired()->maxLength(30);
Expand All @@ -95,7 +96,7 @@
$row = $form->addRow();
$row->addLabel('dob', __('Date of Birth'));
$row->addDate('dob')->isRequired();

$formerRoles = array(
'Student' => __('Student'),
'Staff' => __('Staff'),
Expand Down
34 changes: 28 additions & 6 deletions Alumni/publicRegistrationProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
$URL .= '&return=error5';
header("Location: {$URL}");
} else {
//Write to database
//Check for uniqueness of username
try {
$data = array('title' => $title, 'surname' => $surname, 'firstName' => $firstName, 'officialName' => $officialName, 'maidenName' => $maidenName, 'gender' => $gender, 'username' => $username, 'dob' => $dob, 'email' => $email, 'address1Country' => $address1Country, 'profession' => $profession, 'employer' => $employer, 'jobTitle' => $jobTitle, 'graduatingYear' => $graduatingYear, 'formerRole' => $formerRole);
$sql = 'INSERT INTO alumniAlumnus SET title=:title, surname=:surname, firstName=:firstName, officialName=:officialName, maidenName=:maidenName, gender=:gender, username=:username, dob=:dob, email=:email, address1Country=:address1Country, profession=:profession, employer=:employer, jobTitle=:jobTitle, graduatingYear=:graduatingYear, formerRole=:formerRole';
$data = array('email' => $email);
$sql = 'SELECT email FROM alumniAlumnus WHERE email=:email';
$result = $connection2->prepare($sql);
$result->execute($data);
} catch (PDOException $e) {
Expand All @@ -92,9 +92,31 @@
exit();
}

//Success 0
$URL .= '&return=success0';
header("Location: {$URL}");
if ($result->rowCount() > 0) {
//Fail 7
$URL .= '&return=error7';
header("Location: {$URL}");
exit();
}
else {

//Write to database
try {
$data = array('title' => $title, 'surname' => $surname, 'firstName' => $firstName, 'officialName' => $officialName, 'maidenName' => $maidenName, 'gender' => $gender, 'username' => $username, 'dob' => $dob, 'email' => $email, 'address1Country' => $address1Country, 'profession' => $profession, 'employer' => $employer, 'jobTitle' => $jobTitle, 'graduatingYear' => $graduatingYear, 'formerRole' => $formerRole);
$sql = 'INSERT INTO alumniAlumnus SET title=:title, surname=:surname, firstName=:firstName, officialName=:officialName, maidenName=:maidenName, gender=:gender, username=:username, dob=:dob, email=:email, address1Country=:address1Country, profession=:profession, employer=:employer, jobTitle=:jobTitle, graduatingYear=:graduatingYear, formerRole=:formerRole';
$result = $connection2->prepare($sql);
$result->execute($data);
} catch (PDOException $e) {
//Fail 2
$URL .= 'return=error2';
header("Location: {$URL}");
exit();
}

//Success 0
$URL .= '&return=success0';
header("Location: {$URL}");
}
}
}
}
2 changes: 1 addition & 1 deletion Alumni/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
/**
* Sets version information.
*/
$moduleVersion = '0.5.00';
$moduleVersion = '0.6.00';

0 comments on commit 9842de3

Please sign in to comment.