• Resolved Nand Lal

    (@imaan)


    following filter hook not working in hr emailer class.

    file moduels/hrm/includes/class-emailer.php

    /**
     * HR Email handler class
     */
    class Emailer {
    
        use Hooker;
    
        function __construct() {
            $this->filter( 'erp_email_classes', 'register_emails' );
        }
    
        function register_emails( $emails ) {
    
            $emails['New_Employee_Welcome']   = new Emails\New_Employee_Welcome();
            $emails['New_Leave_Request']      = new Emails\New_Leave_Request();
            $emails['Approved_Leave_Request'] = new Emails\Approved_Leave_Request();
            $emails['Rejected_Leave_Request'] = new Emails\Rejected_Leave_Request();
    
            return apply_filters( 'erp_hr_email_classes', $emails );
        }
    }

    I add filter in my plugin but not working still get email on approved leave request.

    add_filter( 'erp_hr_email_classes', 'my_register_email_classes' );
    function my_register_email_classes( $emails ) {
    
    unset( $emails['Approved_Leave_Request'] );
    return $emails;
    }

    Actually I want to add new custom template tag in the approved email class. but I can find any hook to add custom template tag in the email.

    **
     * Approved Leave Request
     */
    class Approved_Leave_Request extends Email {
    
        use Hooker;
    
        function __construct() {
            $this->id             = 'approved-leave-request';
            $this->title          = __( 'Approved Leave Request', 'erp' );
            $this->description    = __( 'Approved leave request notification to employee.', 'erp' );
    
            $this->subject        = __( 'Your leave request has been approved', 'erp');
            $this->heading        = __( 'Leave Request Approved', 'erp');
    
            $this->find = [
                'full-name'    => '{employee_name}',
                'leave_type'   => '{leave_type}',
                'date_from'    => '{date_from}',
                'date_to'      => '{date_to}',
                'no_days'      => '{no_days}',
                'reason'       => '{reason}',
            ];
    
            $this->action( 'erp_admin_field_' . $this->id . '_help_texts', 'replace_keys' );
    
            parent::__construct();
        } 
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘erp_hr_email_classes filter hook not working’ is closed to new replies.