user_login; $to = 'live@eternal-terror.com'; $subject = $hf_username.' has taken '.$p1. 'for a concert with id '.$c; $body = 'The email body content'; $headers = array('Content-Type: text/html; charset=UTF-8'); if ($p1 == 'photo1') $usql = "UPDATE wpg_concertlogs SET wpgcl_photo1='".$hf_username."' WHERE wpgcl_concertid=".$c; if ($p1 == 'photo2') $usql = "UPDATE wpg_concertlogs SET wpgcl_photo2='".$hf_username."' WHERE wpgcl_concertid=".$c; if ($p1 == 'rev1') $usql = "UPDATE wpg_concertlogs SET wpgcl_rev1='".$hf_username."' WHERE wpgcl_concertid=".$c; if ($p1 == 'rev2') $usql = "UPDATE wpg_concertlogs SET wpgcl_rev2='".$hf_username."' WHERE wpgcl_concertid=".$c; $uresults = $wpdb->get_results($usql); $wpdb->insert( 'wpg_logchanges', array ( 'id' => '', 'userid' => $hf_username, 'action' => 'assigned '.$p1, 'concertid' => $c)); echo ($wpdb->last_error ); wp_mail( $to, $subject, $body, $headers ); } function giglogadmin_unassignconcert($p1, $c) { global $wpdb; $hf_user = wp_get_current_user(); $hf_username = $hf_user->user_login; $to = 'live@eternal-terror.com'; $subject = $hf_username.' has UNASSINED '.$p1. 'for a concert with id '.$c; $body = 'The email body content'; $headers = array('Content-Type: text/html; charset=UTF-8'); if ($p1 == 'photo1') $usql = "UPDATE wpg_concertlogs SET wpgcl_photo1='' WHERE wpgcl_concertid=".$c; if ($p1 == 'photo2') $usql = "UPDATE wpg_concertlogs SET wpgcl_photo2='' WHERE wpgcl_concertid=".$c; if ($p1 == 'rev1') $usql = "UPDATE wpg_concertlogs SET wpgcl_rev1='' WHERE wpgcl_concertid=".$c; if ($p1 == 'rev2') $usql = "UPDATE wpg_concertlogs SET wpgcl_rev2='' WHERE wpgcl_concertid=".$c; $uresults = $wpdb->get_results($usql); $wpdb->insert( 'wpg_logchanges', array ( 'id' => '', 'userid' => $hf_username, 'action' => 'unassigned '.$p1, 'concertid' => $c)); echo ($wpdb->last_error ); wp_mail( $to, $subject, $body, $headers ); } function giglogadmin_getpublishstatus ($c) { global $wpdb; $date1 = new DateTime("now"); $dsql = "select filedate from wpg_files where wpgc_id=".$c; $results = $wpdb->get_results($dsql); foreach ( $results AS $row ) { //$x = strtotime($row -> filedate); $x= date('Y-m-d H:i:s', strtotime($row -> filedate)); $date2 = new DateTime($x, new DateTimeZone('Europe/London')); $dd = date_diff ($date1, $date2); $datediff = $dd ->format('%d'); } if ($datediff <= 10) return ('NEW'); } function giglogadmin_returnuser($p1, $c) { global $wpdb; $hf_user = wp_get_current_user(); $hf_username = $hf_user->user_login; //PHOTO1 if ($p1 == 'photo1') { //checking if taken $vquery0 = "select wpgcl_photo1 from wpg_concertlogs where wpgcl_concertid=".$c ; $results = $wpdb->get_results($vquery0); foreach ( $results AS $row ) $x= $row -> wpgcl_photo1; if ($x !='' and $x!=$hf_username) { return ('Taken by '.$x); } else if ($x==$hf_username) //if current user return ('
'); else //not taken by anyone return (''); } //PHOTO2 if ($p1 == 'photo2') { $vquery0 = "select wpgcl_photo2 from wpg_concertlogs where wpgcl_concertid=".$c ; $results = $wpdb->get_results($vquery0); foreach ( $results AS $row ) $x= $row -> wpgcl_photo2; if ($x !='' and $x!=$hf_username) { return ('Taken by '.$x); } else if ($x==$hf_username) //if current user return (''); else //not taken by anyone return (''); } //TEXT1 if ($p1 == 'rev1') { $vquery0 = "select wpgcl_rev1 from wpg_concertlogs where wpgcl_concertid=".$c ; $results = $wpdb->get_results($vquery0); foreach ( $results AS $row ) $x= $row -> wpgcl_rev1; if ($x !='' and $x!=$hf_username) { return ('Taken by '.$x); } else if ($x==$hf_username) //if current user return (''); else //not taken by anyone return (''); } //TEXT2 if ($p1 == 'rev2') { $vquery0 = "select wpgcl_rev2 from wpg_concertlogs where wpgcl_concertid=".$c ; $results = $wpdb->get_results($vquery0); foreach ( $results AS $row ) $x= $row -> wpgcl_rev2; if ($x !='' and $x!=$hf_username) { return ('Taken by '.$x); } else if ($x==$hf_username) //if current user return (''); else //not taken by anyone return (''); } } function giglogadmin_getfiltersphotog() { global $wpdb; //echo (var_dump($_POST["selectvenue"])); $results = $wpdb->get_results('select distinct wpgvenue_city from wpg_venues'); $select= ''; return $select; } function giglogadmin_getconcertsphotog ( ) { $C_Option = $_POST['selectcity']; $V_Option = $_POST['selectvenue']; $hf_user = wp_get_current_user(); $hf_username = $hf_user->user_login; $roles = ( array ) $hf_user->roles; global $wpdb; // Shortcodes RETURN content, so store in a variable to return $content = 'The available slots are marked with the green checkbox. If you click on it, it will be assigned to you and if you no longer wish to cover that concert, click on the red icon and you will be unassigned. A mail should be sent to the admin when this happens, but in order for the accreditation request to be sent, you have to mail live@eternal-terror.com with the template containing concert information. There might be some exceptions, but those are discussed case by case. So whenever you want a concert, assign yourself and send the template no later than 3 weeks before the concert.CITY | ID | BAND | VENUE | DATE | '; $content .= '||||||
---|---|---|---|---|---|---|---|---|---|---|
CITY | BAND | VENUE | DATE | PHOTO1 | PHOTO2 | TEXT1 | TEXT2 | STATUS | ||
'.$row->wpgvenue_city.' | ||||||||||
'.$row->wpgvenue_city.' | ||||||||||
' . $row->id. ' | '; $content .= ''; $content .= ' | ' . $row->band. ' | '; $content .= '' . $row->venue. ' | '; $fdate = strtotime($row->wpgconcert_date); $newformat = date('d.M.Y',$fdate); //$content .= DATE_FORMAT($fdate,'%d.%b.%Y'); $content .= '' .$newformat. ' | '; $content .= ''.giglogadmin_getpublishstatus($row->id ).' | '; $content .= ''.giglogadmin_returnuser('photo1', $row->id ).' | '; $content .= ''.giglogadmin_returnuser('photo2', $row->id ).' | '; $content .= ''.giglogadmin_returnuser('rev1', $row->id ).' | '; $content .= ''.giglogadmin_returnuser('rev2', $row->id ).' | '; $content .= ''.$row -> wpgs_name; if (current_user_can('administrator')) //($hf_username == 'etadmin') $content .= ''; $content .= ' | '; $content .= '