Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmudev-sls/2caff1b71e72429a9da69e84ceded34a to your computer and use it in GitHub Desktop.
Save wpmudev-sls/2caff1b71e72429a9da69e84ceded34a to your computer and use it in GitHub Desktop.
[Membership - 2] - Disable the registration email on Subscriptions with the Manual gateway
<?php
/**
* Plugin Name: M2P Disable Email On Manual Account Creation
* Description: M2P Disable Email On Manual Account Creation
* Author: Thobk @ WPMUDEV
* Author URI: https://premium.wpmudev.org/profile/tho2757
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'plugins_loaded', 'wpmudev_ms_load_disable_email_func', 100 );
function wpmudev_ms_load_disable_email_func(){
if( defined('MS_IS_PRO') && MS_IS_PRO ){
function wpmudev_ms_disable_all_email_on_manual_account( $member, $subscription, $comm ){
if( 'admin' === $subscription->gateway_id ){
$comm->enabled = false;
}
}
add_action( 'ms_model_communication_send_message_before', 'wpmudev_ms_disable_all_email_on_manual_account', 10, 3 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment