Attempt to reduce duplicated sign-ups.
authorSam White <webmaster@ycra.org.uk>
Sun, 25 Feb 2024 13:24:51 +0000 (06:24 -0700)
committerSam White <webmaster@ycra.org.uk>
Sun, 25 Feb 2024 13:24:51 +0000 (06:24 -0700)
public_html/join.php

index e398e2757509ba2b67965f51dce7913363cb3634..1c7cd295bec838790cb11b4699ccab3eca5af835 100644 (file)
@@ -11,9 +11,13 @@ function validate_member_data(&$errors, $data) {
 
   if (empty($errors)) {
     validate_email_address($errors, $data['email_address']);
-      //TODO: will want to turn this back on in the future.
-      /*if (record_exists('members', simple_where('email_address', $data['email_address'])))
-      $errors[] = 'Email address has already been used.';*/
+    # We explicitly allow the same email address to be associated with multiple
+    # members (e.g. if using a parent's email address), but we require a unique
+    # first name to try and prevent duplicate sign-ups.
+    if (record_exists('members',
+                      simple_where('email_address', $data['email_address'])
+                      .' AND '.simple_where('first_name', $data['first_name'])))
+      $errors[] = 'A member already exists with these details.';
   }
 
   return empty($errors);