php EventsPlus更改新的注册通知电子邮件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php EventsPlus更改新的注册通知电子邮件相关的知识,希望对你有一定的参考价值。

<?php

/**
* Plugin Name: EventsPlus Change New Registration Notification Email
* Plugin URI: https://premium.wpmudev.org/
* Description: Change the email of receiving new registration email in events plus plugin
* Author: Ariful Islam @ WPMUDEV
* Author URI: https://premium.wpmudev.org/profile/itsarifulislam
* License: GPLv2 or later
*/


if ( ! defined( 'ABSPATH' ) ) {
	exit;
}


if ( ! class_exists( 'EventsPlusChangeRegistrationNotificationEmail' ) ) {

	class EventsPlusChangeRegistrationNotificationEmail {

		private static $_instance = null;

		private $actions = array();

		private $send_to = 'test@gmail.com'; // Change the email

		public static function get_instance() {

			if ( is_null( self::$_instance ) ) {
				self::$_instance = new EventsPlusChangeRegistrationNotificationEmail();
			}

			return self::$_instance;

		}


		private function __construct() {

			$this->actions = array(
				'wp_ajax_nopriv_eab_facebook_login',
				'wp_ajax_nopriv_eab_twitter_login',
				'wp_ajax_nopriv_eab_google_login',
				'wp_ajax_nopriv_eab_google_plus_login',
				'wp_ajax_nopriv_eab_wordpress_register'
			);

			$this->populate_actions();
			
		}


		public function populate_actions() {


			foreach ( $this->actions as $action ) {
				add_action( $action, array( $this, 'wp_new_user_notification_email_admin_filter' ) );
			}

		}


		public function wp_new_user_notification_email_admin_filter() {

			add_filter( 'wp_new_user_notification_email_admin', array( $this, 'wp_new_user_notification_email_admin_callback' ), 10, 1 );

		}


		public function wp_new_user_notification_email_admin_callback( $wp_new_user_notification_email ) {
			
			remove_filter( 'wp_new_user_notification_email_admin', array( $this, 'wp_new_user_notification_email_admin_callback' ) );
			
			if ( !empty( $this->send_to ) ) {
				$wp_new_user_notification_email['to'] = $this->send_to;
			}
			
			return $wp_new_user_notification_email;

		}


	}


	function render_eventsPlus_change_registration_notification_email(){

		$GLOBALS['EventsPlusChangeRegistrationNotificationEmail'] = EventsPlusChangeRegistrationNotificationEmail::get_instance();

	}

}


render_eventsPlus_change_registration_notification_email();

以上是关于php EventsPlus更改新的注册通知电子邮件的主要内容,如果未能解决你的问题,请参考以下文章

如何在 PHP 中向用户发送每日电子邮件通知?

如果 facebook connect 用户更改电子邮件,我会收到通知吗?

php WordPress - 当管理员更改其电子邮件地址时,禁用确认通知

南邮数据结构考试时间

贝宝捐赠的通知到别处而不是指定的收件人

注册以接收远程 CloudKit 更改的通知不起作用