Error: No member identification was given.

"; } else { // Check if a member exists with the hash given from ID param. if(!$member = DataObject::get_one('Member', "Hash = '$hash'")) { $content = "

Error: Member does not exist by given parameters.

"; } else { // Check if a group was passed in and exists. if($groupCode = $member->GroupCode) { // Check if the member is in this group. if($group = DataObject::get_one('Group', "Code = '$groupCode'")) { if($member->inGroup($group->ID)) { $content = "

$member->Email is already signed up.

"; } else { // Member is not in the group, so add the member to the group. $member->Groups()->add($group); // Send an email welcoming the member. $email = new ConfirmNewsletterSignup_Email(); $email->to = $member->Email; $email->from = Email::getAdminEmail(); $email->subject = 'Welcome to the mailing list'; $email->populateTemplate(array( 'Member' => $member )); $email->send(); $content = "

$member->Email has been signed up successfully. A welcome email has been sent.

"; } } } } } // Render these variables into the template. Pass in the message from previous logic. $this->customise(array( 'Content' => $content )); // Render with a chosen template. return $this->renderWith(array( 'ConfirmNewsletterSignup_member', 'Page' )); } } class ConfirmNewsletterSignup_Email extends Email_Template { protected $ss_template = 'ConfirmNewsletterSignup_Email'; } ?>