Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Tinnitus Notifier
- Version: 1.0.0
- Author: Adrian PreuΓ
- */
- class Tinnitus_Mails {
- function __construct() {
- define('CRON_NAME', 'tinnitus_cron_shedule');
- #if(!wp_next_scheduled(CRON_NAME)) {
- wp_unschedule_event(time(), CRON_NAME);
- wp_clear_scheduled_hook(CRON_NAME);
- wp_schedule_event(time() - 3600, 'daily', CRON_NAME);
- #}
- add_action(CRON_NAME, array($this, 'shedule'));
- }
- function shedule() {
- header('Content-Type: text/plain; charset=UTF-8');
- $users = get_users();
- foreach($users AS $index => $user) {
- if(get_the_author_meta('email_training', $user->ID) == 1) {
- $responder = get_the_author_meta('email_responder', $user->ID);
- $show = false;
- $payment_time = get_user_meta($user->ID, 'time_payed', true);
- if(isset($payment_time) && $payment_time != false) {
- if(time() - $payment_time > 15778463){
- $payment_time = -1;
- }
- }
- if($payment_time > 0) {
- print $responder;
- print $user->display_name;
- print $user->user_email;
- print "\n";
- // NOT Work!
- #wp_mail($user->user_email, "test", "testststs");
- // Working!
- #mail($user->user_email, "test", "testststs");
- }
- }
- }
- }
- }
- new Tinnitus_Mails();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement