AUDIENCE_ADDAUSER::define_action()
Define and register the action by pushing it into the Automator object
Source
File: src/integrations/mailchimp/actions/audience-addauser.php
public function define_action() { global $uncanny_automator; $action = array( 'author' => $uncanny_automator->get_author_name( $this->action_code ), 'support_link' => $uncanny_automator->get_author_support_link( $this->action_code, 'knowledge-base/mailchimp/' ), 'is_pro' => false, 'integration' => self::$integration, 'code' => $this->action_code, 'sentence' => sprintf( __( 'Add the user to {{an audience:%1$s}}', 'uncanny-automator' ), $this->action_meta ), 'select_option_name' => __( 'Add the user to {{an audience}}', 'uncanny-automator' ), 'priority' => 10, 'accepted_args' => 1, 'execution_function' => array( $this, 'add_update_audience_member' ), 'options_group' => array( $this->action_meta => array( $uncanny_automator->helpers->recipe->mailchimp->options->get_all_lists( __( 'Audience', 'uncanny-automator' ), 'MCLIST', array( 'is_ajax' => true, 'target_field' => 'MCLISTGROUPS', 'endpoint' => 'select_mcgroupslist_from_mclist', ) ), $uncanny_automator->helpers->recipe->mailchimp->options->get_double_opt_in( __( 'Double opt-in', 'uncanny-automator' ), 'MCDOUBLEOPTIN', array( 'description' => __( 'When set to "yes", a confirmation email will be sent before the user is added to the selected audience.', 'uncanny-automator' ), ) ), $uncanny_automator->helpers->recipe->mailchimp->options->get_double_opt_in( __( 'Update existing', 'uncanny-automator' ), 'MCUPDATEEXISTING', array( 'description' => __( 'If this is set to Yes, the information provided will be used to update the existing user. Fields that are left blank will not be updated.', 'uncanny-automator' ), ) ), $uncanny_automator->helpers->recipe->mailchimp->options->get_double_opt_in( __( 'Change groups?', 'uncanny-automator' ), 'MCCHANGEGROUPS', array( 'options' => array( 'replace-all' => __( 'Replace all', 'uncanny-automator' ), 'add-only' => __( 'Add only', 'uncanny-automator' ), 'replace-matching' => __( 'Replace matching', 'uncanny-automator' ), ), 'description' => __( "Add only: The group(s) specified below will be added to the subscriber's existing groups/interests. Replace All: All of the subscriber's existing groups will be cleared, and replaced with the groups selected below. Replace Matching: Clears any existing group selections only for the groups specified below.", 'uncanny-automator' ), ) ), $uncanny_automator->helpers->recipe->mailchimp->options->get_list_groups( __( 'Groups', 'uncanny-automator' ), 'MCLISTGROUPS', array( // 'is_ajax' => TRUE, 'required' => false, ) ), $uncanny_automator->helpers->recipe->field->text_field( 'MCLANGUAGECODE', __( 'Language code', 'uncanny-automator' ), true, 'text', null, false ), array( 'option_code' => 'MERGE_FIELDS', 'input_type' => 'repeater', 'label' => __( 'Merge fields', 'uncanny-automator' ), /* translators: 1. Button */ 'description' => __( '', 'uncanny-automator' ), 'required' => true, 'fields' => array( array( 'option_code' => 'FIELD_NAME', 'label' => __( 'Field', 'uncanny-automator' ), 'input_type' => 'text', 'required' => true, 'read_only' => true, 'options' => array(), ), $uncanny_automator->helpers->recipe->field->text_field( 'FIELD_VALUE', __( 'Value', 'uncanny-automator' ), true, 'text', '', false ), ), 'add_row_button' => __( 'Add pair', 'uncanny-automator' ), 'remove_row_button' => __( 'Remove pair', 'uncanny-automator' ), 'hide_actions' => true, ), ), ), 'buttons' => array( array( 'show_in' => $this->action_meta, 'text' => __( 'Load fields', 'uncanny-automator' ), 'css_classes' => 'uap-btn uap-btn--red', 'on_click' => $this->get_samples_js(), 'modules' => array( 'modal', 'markdown' ), ), ), ); $uncanny_automator->register->action( $action ); }
Expand full source code Collapse full source code View on Github