BDB_USERPOSTREPLYFORUM::define_trigger()
Define and register the trigger by pushing it into the Automator object
Source Source
File: src/integrations/buddyboss/triggers/bdb-userpostreplyforum.php
public function define_trigger() { $args = [ 'post_type' => 'forum', 'posts_per_page' => 999, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => [ 'publish', 'private' ], ]; $options = Automator()->helpers->recipe->options->wp_query( $args, true, __( 'Any forum', 'uncanny-automator' ) ); $forum_relevant_tokens = [ 'BDBFORUMS' => __( 'Forum title', 'uncanny-automator' ), 'BDBFORUMS_ID' => __( 'Forum ID', 'uncanny-automator' ), 'BDBFORUMS_URL' => __( 'Forum URL', 'uncanny-automator' ), ]; $relevant_tokens = [ $this->trigger_meta => __( 'Topic title', 'uncanny-automator' ), $this->trigger_meta . '_ID' => __( 'Topic ID', 'uncanny-automator' ), $this->trigger_meta . '_URL' => __( 'Topic URL', 'uncanny-automator' ), ]; $trigger = array( 'author' => Automator()->get_author_name( $this->trigger_code ), 'support_link' => Automator()->get_author_support_link( $this->trigger_code, 'integration/buddyboss/' ), 'integration' => self::$integration, 'code' => $this->trigger_code, /* translators: Logged-in trigger - bbPress */ 'sentence' => sprintf( __( 'A user replies to {{a topic:%1$s}} in {{a forum:%2$s}}', 'uncanny-automator' ), $this->trigger_meta, 'BDBFORUMS' ), /* translators: Logged-in trigger - bbPress */ 'select_option_name' => __( 'A user replies to {{a topic}} in {{a forum}}', 'uncanny-automator' ), 'action' => 'bbp_new_reply', 'priority' => 10, 'accepted_args' => 3, 'validation_function' => array( $this, 'bbp_insert_reply' ), 'options_group' => [ $this->trigger_meta => [ Automator()->helpers->recipe->field->select_field_ajax( 'BDBFORUMS', __( 'Forum', 'uncanny-automator' ), $options, '', '', false, true, [ 'target_field' => $this->trigger_meta, 'endpoint' => 'select_topic_from_forum_BDBTOPICREPLY', ], $forum_relevant_tokens ), Automator()->helpers->recipe->field->select_field( $this->trigger_meta, __( 'Topic', 'uncanny-automator' ), array(), false, false, false, $relevant_tokens ), ], ], ); Automator()->register->trigger( $trigger ); return; }
Expand full source code Collapse full source code View on Github