Noptin_Email_Action::can_run( Noptin_Subscriber $subscriber, Noptin_Automation_Rule $rule, array $args )

Returns whether or not the action can run (dependancies are installed).


Parameters Parameters

$subscriber

(Noptin_Subscriber) (Required) The subscriber.

$rule

(Noptin_Automation_Rule) (Required) The automation rule used to trigger the action.

$args

(array) (Required) Extra arguments passed to the action.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/automation-rules/actions/class-noptin-email-action.php

    public function can_run( $subscriber, $rule, $args ) {

        // Abort if we do not have a subject or an email.
        if ( empty( $rule->action_settings['email_content'] ) || empty( $rule->action_settings['email_subject'] ) ) {
            log_noptin_message(
                sprintf(
                    __( 'Email automation rule action not sent to %s because either the subject or the content has not been set' ),
                    $subscriber->email
                )
            );
            return false;
        }

        // We only want to send an email to active subscribers.
        if ( ! empty( $subscriber->active ) ) {
            log_noptin_message(
                sprintf(
                    __( 'Email automation rule action not sent to %s because the subscriber is not active' ),
                    $subscriber->email
                )
            );
			return false;
        }

        return true;
    }


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.3.3Introduced.

Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation