/** * Tab mail settings */ public static function tab_mail_settings() { ?> <h3><?php esc_attr_e('Text templates', 'questions-locale'); ?> </h3> <table class="form-table"> <tr> <th class="titledesc"><label for="questions_thankyou_participating_subject_template"> <?php esc_attr_e('Thanks for participating', 'questions-locale'); ?> </label></th> <td class="forminp forminp-textarea"> <p><?php esc_attr_e('This text will be used on thanking members after participating survey.', 'questions-locale'); ?> </p> <input class="large-text settings-template-subject" type="text" id="questions_thankyou_participating_subject_template" name="questions_thankyou_participating_subject_template" value="<?php echo qu_get_mail_template_subject('thankyou_participating'); ?> " /><br /> <textarea id="questions-thankyou-participating-text-template" name="questions_thankyou_participating_text_template" class="large-text questions-text-template" cols="80" rows="10" /><?php echo qu_get_mail_template_text('thankyou_participating'); ?> </textarea> <br /><span class="description"><?php esc_attr_e('Usable template tags:', 'questions-locale'); ?> %username%, %displayname%, %survey_title%, %site_name%</span> </td> </tr> <tr> <th class="titledesc"><label for="questions_invitation_subject_template"> <?php esc_attr_e('Invitation text Template', 'questions-locale'); ?> </label></th> <td class="forminp forminp-textarea"> <p><?php esc_attr_e('This text will be used as template if you want to send invitations to Participiants.', 'questions-locale'); ?> </p> <input class="large-text settings-template-subject" type="text" id="questions_invitation_subject_template" name="questions_invitation_subject_template" value="<?php echo qu_get_mail_template_subject('invitation'); ?> " /><br /> <textarea id="questions-invitation-text-template" name="questions_invitation_text_template" class="large-text questions-text-template" cols="80" rows="10" /><?php echo qu_get_mail_template_text('invitation'); ?> </textarea> <br /><span class="description"><?php esc_attr_e('Usable template tags:', 'questions-locale'); ?> %username%, %displayname%, %survey_title%, %survey_url%, %site_name%</span> </td> </tr> <tr> <th class="titledesc"><label for="questions_reinvitation_subject_template"><?php esc_attr_e('Reinvitation text Template', 'questions-locale'); ?> </label></th> <td class="forminp forminp-textarea"> <p><?php esc_attr_e('This text will be used as template if you want to send reinvitations to Participiants.', 'questions-locale'); ?> </p> <input class="large-text settings-template-subject" type="text" id="questions_reinvitation_subject_template" name="questions_reinvitation_subject_template" value="<?php echo qu_get_mail_template_subject('reinvitation'); ?> " /><br /> <textarea id="questions-reinvitation-text-template" name="questions_reinvitation_text_template" class="large-text questions-text-template" cols="80" rows="10" /><?php echo qu_get_mail_template_text('reinvitation'); ?> </textarea> <br /><span class="description"><?php esc_attr_e('Usable template tags:', 'questions-locale'); ?> %username%, %displayname%, %survey_title%, %survey_url%, %site_name%</span> </td> </tr> <tr> <th class="titledesc"><label for="questions_mail_from_name"><?php esc_attr_e('From Name', 'questions-locale'); ?> </label></th> <td class="forminp forminp-textarea"> <p><?php esc_attr_e('The Name which will be shown on Emails which are send out by Questions.', 'questions-locale'); ?> </p> <input class="large-text settings-template-subject" type="text" id="questions_mail_from_name" name="questions_mail_from_name" value="<?php echo qu_get_mail_settings('from_name'); ?> " /><br /> <span class="description"><?php esc_attr_e('e.g. Michael Jackson', 'questions-locale'); ?> </span> </td> </tr> <tr> <th class="titledesc"><label for="questions_mail_from_email"><?php esc_attr_e('From Email', 'questions-locale'); ?> </label></th> <td class="forminp forminp-textarea"> <p><?php esc_attr_e('The Email will be used for the reply of the emails, send out by questions.', 'questions-locale'); ?> </p> <input class="large-text settings-template-subject" type="text" id="questions_mail_from_email" name="questions_mail_from_email" value="<?php echo qu_get_mail_settings('from_email'); ?> " /><br /> <span class="description"><?php esc_attr_e('e.g. myname@mydomain.com', 'questions-locale'); ?> </span> </td> </tr> </table> <?php }
/** * Sending out finish email to participator * @since 1.0.0 */ public function email_finished() { global $post, $current_user; get_currentuserinfo(); $subject_template = qu_get_mail_template_subject('thankyou_participating'); $subject = str_replace('%displayname%', $current_user->display_name, $subject_template); $subject = str_replace('%username%', $current_user->user_nicename, $subject); $subject = str_replace('%site_name%', get_bloginfo('name'), $subject); $subject = str_replace('%survey_title%', $post->post_title, $subject); $subject = apply_filters('questions_email_finished_subject', $subject); $text_template = qu_get_mail_template_text('thankyou_participating'); $content = str_replace('%displayname%', $current_user->display_name, $text_template); $content = str_replace('%username%', $current_user->user_nicename, $content); $content = str_replace('%site_name%', get_bloginfo('name'), $content); $content = str_replace('%survey_title%', $post->post_title, $content); $content = apply_filters('questions_email_finished_content', $content); qu_mail($current_user->user_email, $subject, $content); }
/** * Invitations box * * @since 1.0.0 */ public static function meta_box_form_functions() { global $post; $questions_invitation_text_template = qu_get_mail_template_text('invitation'); $questions_reinvitation_text_template = qu_get_mail_template_text('reinvitation'); $questions_invitation_subject_template = qu_get_mail_template_subject('invitation'); $questions_reinvitation_subject_template = qu_get_mail_template_subject('reinvitation'); // Dublicate survey $html = '<div class="questions-function-element">'; $html .= '<input id="questions-duplicate-button" name="questions-duplicate-survey" type="button" class="button" value="' . esc_attr__('Duplicate Survey', 'questions-locale') . '" />'; $html .= '</div>'; // Delete results $html .= '<div class="questions-function-element">'; $html .= '<input id="questions-delete-results-button" name="questions-delete-results" type="button" class="button" value="' . esc_attr__('Delete survey results', 'questions-locale') . '" />'; $html .= '</div>'; if ('publish' == $post->post_status) { $html .= '<div class="questions-function-element">'; $html .= '<input id="questions-invite-subject" type="text" name="questions_invite_subject" value="' . $questions_invitation_subject_template . '" />'; $html .= '<textarea id="questions-invite-text" name="questions_invite_text">' . $questions_invitation_text_template . '</textarea>'; $html .= '<input id="questions-invite-button" type="button" class="button" value="' . esc_attr__('Invite Participiants', 'questions-locale') . '" /> '; $html .= '<input id="questions-invite-button-cancel" type="button" class="button" value="' . esc_attr__('Cancel', 'questions-locale') . '" />'; $html .= '</div>'; $html .= '<div class="questions-function-element">'; $html .= '<input id="questions-reinvite-subject" type="text" name="questions_invite_subject" value="' . $questions_reinvitation_subject_template . '" />'; $html .= '<textarea id="questions-reinvite-text" name="questions_reinvite_text">' . $questions_reinvitation_text_template . '</textarea>'; $html .= '<input id="questions-reinvite-button" type="button" class="button" value="' . esc_attr__('Reinvite Participiants', 'questions-locale') . '" /> '; $html .= '<input id="questions-reinvite-button-cancel" type="button" class="button" value="' . esc_attr__('Cancel', 'questions-locale') . '" />'; $html .= '</div>'; } else { $html .= '<p>' . esc_attr__('You can invite Participiants to this survey after the survey is published.', 'questions-locale') . '</p>'; } echo $html; }