正文
WHMCS教程-0元免费产品不给用户发送邮箱账单
WHMCS教程-0元免费产品不给用户发送邮箱账单
文件下载:DisableNotificationFreeInvoices
使用方法:文件放到/modules/addons目录内即可,无需其他设置。
自行进行病毒查杀操作
文件源码:
DisableNotificationFreeInvoices.php
<?php /** * 白熊开源实验室 */ function DisableNotificationFreeInvoices_config() { $configarray = [ "name" => "免费账单不发送邮件通知", "description" => "开启后用户若购买的免费产品,即价格为0.00,则系统不发送账单通知到邮箱.", "version" => "1.0", "author" => "白熊开源实验室", "fields" => [ ] ]; return $configarray; }
hooks.php
<?php /** * 白熊开源实验室 */ use Illuminate\Database\Capsule\Manager as Capsule; add_hook( "EmailPreSend", 1, function ( $vars ) { $email_template_name = $vars['messagename']; $merge_fields = []; if ( $email_template_name == "Invoice Created" || $email_template_name == "Invoice Payment Confirmation" ) { $getInvoice = Capsule::table( 'tblinvoices' )->where( 'id', $vars['relid'] )->first(); if ( $getInvoice->total == '0.00' ) { $merge_fields['abortsend'] = true; } } return $merge_fields; } );