/** * This function will create new registration forms for students and parents. * * This function is responsible for creating new registration forms for both * students and parents. This function will only create new registration forms * for students and parents if it is used ONLY in conjunction with the form * used to create new music competitions. * * @param Entry Object $entry The entry that was just submitted * @param Form Object $form The form used to submit entries * * @since 1.0.0 * @author KREW */ public static function aria_create_teacher_and_student_forms($confirmation, $form, $entry, $ajax) { // make sure the create competition form is calling this function $competition_creation_form_id = ARIA_API::aria_get_create_competition_form_id(); if ($form['id'] === $competition_creation_form_id) { /* Calls wp_die and returns a value of 86? self::aria_update_page_ids(); */ $field_mapping = self::aria_get_competition_entry_meta(); $competition_name = $entry[$field_mapping['Name of Competition']]; // create the student and teacher forms $student_form_id = self::aria_create_student_form($entry); $teacher_form_id = self::aria_create_teacher_form($entry, unserialize($entry[(string) $field_mapping['Volunteer Times']])); $student_form_url = self::aria_publish_form("{$competition_name} Student Registration", $student_form_id); $teacher_form_url = self::aria_publish_form("{$competition_name} Teacher Registration", $teacher_form_id); // create the sutdent and teacher (master) forms $student_master_form_id = ARIA_Create_Master_Forms::aria_create_student_master_form($competition_name); $teacher_master_form_id = ARIA_Create_Master_Forms::aria_create_teacher_master_form($competition_name); $related_forms = array('student_public_form_id' => $student_form_id, 'teacher_public_form_id' => $teacher_form_id, 'student_master_form_id' => $student_master_form_id, 'teacher_master_form_id' => $teacher_master_form_id, 'student_public_form_url' => $student_form_url, 'teacher_public_form_url' => $teacher_form_url); $student_public_form = GFAPI::get_form($student_form_id); $teacher_public_form = GFAPI::get_form($teacher_form_id); $student_master_form = GFAPI::get_form($student_master_form_id); $teacher_master_form = GFAPI::get_form($teacher_master_form_id); $student_public_form['aria_relations'] = $related_forms; $teacher_public_form['aria_relations'] = $related_forms; $student_master_form['aria_relations'] = $related_forms; $teacher_master_form['aria_relations'] = $related_forms; GFAPI::update_form($student_public_form); GFAPI::update_form($teacher_public_form); GFAPI::update_form($student_master_form); GFAPI::update_form($teacher_master_form); $teacher_public_form = GFAPI::get_form($teacher_form_id); $confirmation = 'Congratulations! A new music competition has been '; $confirmation .= 'created. The following forms are now available for '; $confirmation .= ' students and teachers to use for registration: </br>'; $confirmation .= "<a href={$student_form_url}>{$competition_name} Student Registration</a>"; $confirmation .= " was published. </br>"; $confirmation .= "<a href={$teacher_form_url}> {$competition_name} Teacher Registration </a>"; $confirmation .= " was published."; return $confirmation; } else { wp_die("ERROR: No form currently exists that allows the festival chairman\n to create a new music competition \n FormID: {$form[id]} \n func_call {$competition_creation_form_id}"); } }