summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorAndreaChirulescu <andrea.chirulescu@gmail.com>2021-09-06 21:58:15 +0200
committerAndreaChirulescu <andrea.chirulescu@gmail.com>2021-09-06 21:58:15 +0200
commite3d7d2c32808a7a9360fa6a9f72c0e4d976f4125 (patch)
tree888861793a11db01e8357c0b7b89e8816a940fa4 /includes
parent9670951afb5389a97f1f5156df2a80e2c9d29c48 (diff)
downloadgigologadmin-e3d7d2c32808a7a9360fa6a9f72c0e4d976f4125.tar.gz
gigologadmin-e3d7d2c32808a7a9360fa6a9f72c0e4d976f4125.tar.bz2
gigologadmin-e3d7d2c32808a7a9360fa6a9f72c0e4d976f4125.zip
Fixed wording in mails sent when concerts are assigned/unassinged
Added mailing for when concert status changes. Not sure how to get line break in text mails AND concert status as text
Diffstat (limited to 'includes')
-rw-r--r--includes/admin/views/giglog_admin_page.php33
1 files changed, 29 insertions, 4 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php
index 89ca490..00101af 100644
--- a/includes/admin/views/giglog_admin_page.php
+++ b/includes/admin/views/giglog_admin_page.php
@@ -103,6 +103,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
$concert = GiglogAdmin_Concert::get(intval($_POST['cid']));
$concert->set_status(intval($_POST['selectstatus']));
$concert->save();
+ GiglogAdmin_AdminPage::emailuser($concert,intval($_POST['selectstatus']));
}
}
@@ -169,8 +170,8 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
$concert->save();
$to = 'live@eternal-terror.com';
- $subject = $username.' has taken '.$p1. 'for a concert with id '.$concert->id();
- $body = 'The email body content';
+ $subject = 'WP-GIGLOG '.$username.' has taken '.$p1. 'for a concert with id '.$concert->id();
+ $body = 'WP-GIGLOG '.$username.' has taken '.$p1. 'for a concert with id '.$concert->id();
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( $to, $subject, $body, $headers );
@@ -183,8 +184,32 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
$concert->save();
$to = 'live@eternal-terror.com';
- $subject = $username.' has UNASSINED '.$p1. 'for a concert with id '.$concert->id();
- $body = 'The email body content';
+ $subject = 'WP-GIGLOG '.$username.' has UNASSIGNED '.$p1. 'for a concert with id '.$concert->id();
+ $body = 'WP-GIGLOG '.$username.' has UNASSIGNED '.$p1. 'for a concert with id '.$concert->id();
+ $headers = array('Content-Type: text/html; charset=UTF-8');
+
+ wp_mail( $to, $subject, $body, $headers );
+ }
+
+ static function emailuser(GiglogAdmin_Concert $concert, $cstatus): void
+ {
+ $username = wp_get_current_user()->user_login;
+ $useremail = 'live@eternal-terror.com';
+ $dest = '';
+ $roles = $concert -> roles();
+ $x = '';
+ foreach ($roles AS $role) {
+ if($role){
+ $cuser = get_user_by( 'login', $role);
+ $dest.= $cuser->user_email.';';
+ }
+ }
+
+ $to = $useremail; //change to $dest once testing is ok
+ $subject = 'Message from GIGLOG: Concert '.$concert->cname().' has a new status '.$cstatus. '.';
+ $body = 'You receive this message because you have assigned one of the roles for Concert '.$concert->cname().'.';
+ $body .= '\r\n This is to inform you that there is a new status for the acreditation '.$cstatus. '.';
+ $body .= '\r\n Should you no longer want to receive updates about this concert, please log in to Giglog and remove yourself from the concert. Thanks!';
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( $to, $subject, $body, $headers );