php [会员资格] - 添加编辑电子邮件以获取自动电子邮件回复中的副本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php [会员资格] - 添加编辑电子邮件以获取自动电子邮件回复中的副本相关的知识,希望对你有一定的参考价值。

<?php
/*
Plugin Name: [Membership] add editors in auto emails
Plugin URI: https://premium.wpmudev.org/
Description: Adds editors emails in the "Send copy to Administrator"
Author: Panos Lyrakis @ WPMUDEV
Author URI: https://premium.wpmudev.org/
License: GPLv2 or later
*/

add_filter( 'ms_view_settings_prepare_email_fields', function( $fields ){

	$admin_emails = $fields['cc_email']['field_options'];
	$editor_emails = array();

		$args = array(
			'role' => 'editor',
			'fields' => array( 'ID', 'user_email' ),
		);

		$wp_user_search = new WP_User_Query( $args );
		$users = $wp_user_search->get_results();

		if ( ! empty ($users ) ) {
			foreach ( $users as $user ) {
				$editor_emails[ $user->user_email ] = $user->user_email;
			}
		}

		$fields['cc_email']['field_options'] = array_merge( $admin_emails, $editor_emails );

		return $fields;

}, 10 );

以上是关于php [会员资格] - 添加编辑电子邮件以获取自动电子邮件回复中的副本的主要内容,如果未能解决你的问题,请参考以下文章

php [会员资格] - 重新发送欢迎电子邮件

php [会员资格] - 滴滴涕会员倒计时

php 删除OG会员资格

php 查询WooCommerce会员资格和FacetWP

php 查询WooCommerce会员资格和FacetWP

php 查询WooCommerce会员资格和FacetWP