LD_MAKEUSERLEADER::define_action()
Define and register the action by pushing it into the Automator object
Source Source
File: src/integrations/learndash/actions/ld-makeuserleader.php
public function define_action() { $args = [ 'post_type' => 'groups', 'posts_per_page' => 999, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'publish', ]; $options = Automator()->helpers->recipe->options->wp_query( $args ); $action = array( 'author' => Automator()->get_author_name( $this->action_code ), 'support_link' => Automator()->get_author_support_link( $this->action_code, 'integration/learndash/' ), 'integration' => self::$integration, 'code' => $this->action_code, /* translators: Logged-in trigger - Uncanny Groups */ 'sentence' => sprintf( esc_attr__( 'Make the user the leader of {{a group:%1$s}}', 'uncanny-automator' ), $this->action_meta ), /* translators: Logged-in trigger - Uncanny Groups */ 'select_option_name' => esc_attr__( 'Make the user the leader of {{a group}}', 'uncanny-automator' ), 'priority' => 10, 'accepted_args' => 1, 'execution_function' => array( $this, 'make_user_leader_of_group' ), 'options_group' => [ $this->action_meta => [ [ 'option_code' => 'LDGROUP', 'label' => esc_attr__( 'Group', 'uncanny-automator' ), 'input_type' => 'select', 'required' => true, 'options' => $options, ], array( 'input_type' => 'select', 'option_code' => 'GROUP_LEADER_ROLE_ASSIGNMENT', /* translators: Uncanny Groups */ 'label' => esc_attr__( 'If the user does not currently have the Group Leader role', 'uncanny-automator' ), 'description' => '<div class="user-selector__warning">' . esc_attr__( 'Only users with the Group Leader role can be made the leader of a group.', 'uncanny-automator' ) . '</div>', 'required' => true, 'default_value' => 'do_nothing', 'options' => array( 'do_nothing' => esc_attr__( 'Do nothing', 'uncanny-automator' ), 'add' => esc_attr__( 'Add the role to their existing role(s)', 'uncanny-automator' ), 'replace' => esc_attr__( 'Replace their existing role(s) with the Group Leader role', 'uncanny-automator' ), ), 'supports_custom_value' => false, 'supports_tokens' => false, ), ], ], ); Automator()->register->action( $action ); }
Expand full source code Collapse full source code View on Github