Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Last active November 27, 2018 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmudev-sls/ab08d64559ca6bfdd533bcf84a61e5ec to your computer and use it in GitHub Desktop.
Save wpmudev-sls/ab08d64559ca6bfdd533bcf84a61e5ec to your computer and use it in GitHub Desktop.
Appointments - Change Pending E-mail Body
<?php
/**
* Plugin Name: Appointments - Change Pending E-mail Body
* Plugin URI: https://premium.wpmudev.org/
* Description: mu-plugin for changing the Appointments pending body message.
* Version: 1.0.0
* Author: Konstantinos Xenos @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* License: GPLv2 or later
*/
class Change_Pending_App_Notification {
/**
* Constructor.
*/
public function __construct() {
add_filter( 'app-messages-worker-notification', array( $this, 'change_email_body' ), 15, 3 );
add_filter( 'app-messages-notification-body', array( $this, 'change_email_body' ), 15, 3 );
}
/**
* Change the body of the mail
*
* @param string $body The body of the e-mail.
* @param array $r Request.
* @param int $app_id The Application ID.
*
* @return string $new_body The new body of the e-mail.
*/
public function change_email_body( $body, $r, $app_id ) {
add_filter( 'app-emails-content_type', array( $this, 'change_email_content_type' ) );
$body = '<p style="color:green;"><strong>New pending Appointment with ID ' . $app_id . '!</strong></p>';
$body .= '<p>You can edit it clicking <a href="' . admin_url() . 'admin.php?page=appointments&type=pending">HERE</a></p>';
return $body;
}
/**
* Changes the e-mail headers to text/html.
*
* @return string Header content type of text/html.
*/
public function change_email_content_type() {
$content_type = 'text/html';
return $content_type;
}
}
new Change_Pending_App_Notification();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment