Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkGuardianEmail($emailAddress, $school_id) {
- // Check to see if emailAddress and school_id exist
- if(!$emailAddress || !$school_id) return false;
- // If so then continue
- $school = new school;
- $school->loadFrontendForLogin($school_id);
- // Check to see if school_id exist
- if(!$school->id) return false;
- // If so then continue
- $guardian = new guardian;
- $guardian->loadAllTotal($school->id);
- // Loop through guardian records for selected school
- foreach($guardian->guardians as $item) {
- // Check to see if guardian is active
- if(!$item->active)continue;
- // If so then check to see if emailAddress matches database records
- if(strtolower($item->email) == strtolower($emailAddress) || strtolower($item->email_2) == strtolower($emailAddress))
- {
- // Guardians username, password and school
- $username = $item->username;
- $password = $item->password;
- // Set body for what is shown in email sent to guardian
- $body = "
- The following details are to the parent login. We recommend you change your password straight away.
- Username: $username
- Password: $password
- <br>
- <br>
- ";
- $email = new email; //initialise and connect. We are keeping the connection open for
- $email->connect();
- $recipients = array($item->email, $item->email_2);
- $email->schoolTitle = $school->title;
- $email->schoolEmail = $school->school_contact->email;
- $email->to = implode(',', $recipients);
- $email->subject = "School Spider: Forgot Password";
- $email->message = $body;
- return ($email->sendSingle()) ? true : false;
- }
- }
- // else return false
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement