- updated structure for action scheduler;

This commit is contained in:
Mykyta Synelnikov
2024-09-06 15:03:50 +03:00
parent 5385e07a5f
commit 6df83f4f09
9 changed files with 201 additions and 236 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace um\common\actions;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\common\actions\Emails' ) ) {
/**
* Class Emails
*
* @package um\common\actions
*/
class Emails {
public function __construct() {
add_action( 'um_send_deleted_user_email', array( $this, 'send' ), 10, 3 );
}
/**
* Send an email after user account was deleted.
*
* @param string $user_email User email.
* @param string $template Template name.
* @param array $args Email additional arguments.
*/
public function send( $user_email, $template, $args = array() ) {
if ( empty( $user_email ) && empty( $template ) ) {
return;
}
UM()->mail()->send( $user_email, $template, $args );
}
}
}
+12
View File
@@ -20,6 +20,8 @@ if ( ! class_exists( 'um\common\Init' ) ) {
* @used-by \UM::includes()
*/
public function includes() {
$this->actions();
$this->cpt()->hooks();
$this->screen();
$this->secure()->hooks();
@@ -27,6 +29,16 @@ if ( ! class_exists( 'um\common\Init' ) ) {
$this->theme()->hooks();
}
/**
* @since 2.6.8
*
*/
private function actions() {
if ( empty( UM()->classes['um\common\actions\emails'] ) ) {
UM()->classes['um\common\actions\emails'] = new actions\Emails();
}
}
/**
* @since 2.6.8
*