Exemplo n.º 1
0
					<br />
					<?php 
_e('<b>Note:</b> This email will only be sent for explicitly removed appointments only. The appointments that get removed due to expiration will not be affected.', 'appointments');
?>
				</span>
			</td>
		</tr>

		<tr>
			<th scope="row"><?php 
_e('Removal Notification Email Subject', 'appointments');
?>
</th>
			<td>
				<?php 
$rn_subject = !empty($appointments->options['removal_notification_subject']) ? $appointments->options['removal_notification_subject'] : App_Template::get_default_removal_notification_subject();
?>
				<input value="<?php 
echo esc_attr($rn_subject);
?>
" size="90" name="removal_notification_subject" type="text" />
			</td>
		</tr>

		<tr>
			<th scope="row"><?php 
_e('Removal Notification Email Message', 'appointments');
?>
</th>
			<td>
				<?php 
Exemplo n.º 2
0
 /**
  * Sends out a removal notification email.
  * This email is sent out only on admin status change, *not* on appointment cancellation by user.
  * The email will go out to the client and, perhaps, worker and admin.
  */
 function send_removal_notification($app_id)
 {
     if (!isset($this->options["send_removal_notification"]) || 'yes' != $this->options["send_removal_notification"]) {
         return false;
     }
     $app = $this->get_app($app_id);
     $log = isset($this->options["log_emails"]) && 'yes' == $this->options["log_emails"];
     $email = !empty($app->email) ? $app->email : false;
     if (empty($email) && !empty($app->user) && is_numeric($app->user)) {
         // If we don't have an email, try getting one if user ID is set
         $wp_user = get_user_by('id', (int) $app->user);
         if ($wp_user && !empty($wp_user->user_email)) {
             $email = $wp_user->user_email;
         }
     }
     if (empty($email)) {
         // No reason to carry on, we don't know how to notify the client
         if ($log) {
             $this->log(sprintf(__('Unable to notify the client about the appointment ID:%s removal, stopping.', 'appointments'), $app_id));
         }
         return false;
     }
     $subject = !empty($this->options['removal_notification_subject']) ? $this->options['removal_notification_subject'] : App_Template::get_default_removal_notification_subject();
     $subject = $this->_replace($subject, $app->name, $this->get_service_name($app->service), $this->get_worker_name($app->worker), $app->start, $app->price, $this->get_deposit($app->price), $app->phone, $app->note, $app->address, $app->email, $app->city);
     $msg = !empty($this->options['removal_notification_message']) ? $this->options['removal_notification_message'] : App_Template::get_default_removal_notification_message();
     $msg = $this->_replace($msg, $app->name, $this->get_service_name($app->service), $this->get_worker_name($app->worker), $app->start, $app->price, $this->get_deposit($app->price), $app->phone, $app->note, $app->address, $app->email, $app->city);
     $msg = apply_filters('app_removal_notification_message', $msg, $app, $app_id);
     $result = wp_mail($email, $subject, $msg, $this->message_headers());
     if ($result && $log) {
         $this->log(sprintf(__('Removal notification message sent to %s for appointment ID:%s', 'appointments'), $email, $app_id));
     }
     $disable = apply_filters('app_removal_notification_disable_admin', false, $app, $app_id);
     if ($disable) {
         return false;
     }
     //  Send a copy to admin and service provider
     $to = array($this->get_admin_email());
     $worker_email = $this->get_worker_email($app->worker);
     if ($worker_email) {
         $to[] = $worker_email;
     }
     $provider_add_text = sprintf(__('An appointment removal notification for %s has been sent to your client:', 'appointments'), $app_id);
     $provider_add_text .= "\n\n\n";
     wp_mail($to, __('Removal notification', 'appointments'), $provider_add_text . $msg, $this->message_headers());
     return true;
 }