Noptin_Abstract_Trigger::trigger( int|object|array|Noptin_Subscriber $subscriber, array $args )

Triggers action callbacks.


Parameters Parameters

$subscriber

(int|object|array|Noptin_Subscriber) (Required) The subscriber.

$args

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


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/automation-rules/triggers/class-noptin-abstract-trigger.php

    public function trigger( $subscriber, $args ) {

        $subscriber = new Noptin_Subscriber( $subscriber );

        foreach ( $this->get_rules() as $rule ) {

            // Retrieve the action.
            $action = noptin()->automation_rules->get_action( $rule->action_id );
            if ( empty( $action ) ) {
                continue;
            }

            // Prepare the rule.
            $rule = noptin()->automation_rules->prepare_rule( $rule );

            // Ensure that the rule is valid for the provided args.
            if ( $this->is_rule_valid_for_args( $rule, $args, $subscriber, $action ) ) {
                $action->maybe_run( $subscriber, $rule, $args );
            }

        }

    }


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.8Introduced.

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