Noptin_Custom_Field_Action::run( Noptin_Subscriber $subscriber, Noptin_Automation_Rule $rule, array $args )

Update a subscriber’s custom field.


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

(void)


Top ↑

Source Source

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

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

        $settings = $rule->action_settings;

        // Nothing to do here.
        if ( empty( $settings['field_name'] ) ) {
            return;
        }

        $field_name  = esc_html( $settings['field_name'] );
        if ( empty( $settings['field_value'] ) ) {
            return delete_noptin_subscriber_meta( $subscriber->id, $field_name );
        }

        $field_value = esc_html( $settings['field_value'] );

        return update_noptin_subscriber_meta( $subscriber->id, $field_name, $field_value );

    }


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