Automator_Get_Data::action_integration_from_action_code( null $action_code = null )
Accepts a action code(most like from action meta) and returns that associated action sentence
Contents
Parameters Parameters
- $action_code
-
(null) (Optional)
Default value: null
Return Return
(string)
Source Source
File: src/core/lib/utilities/class-automator-get-data.php
public function action_integration_from_action_code( $action_code = null ) { if ( null === $action_code || ! is_string( $action_code ) ) { Automator()->error->add_error( 'action_integration_from_action_code', 'ERROR: You are trying to get a action integration code from a action code without providing an $action_code', $this ); return null; } // Load all default trigger settings $system_actions = Automator()->get_actions(); if ( empty( $system_actions ) ) { return null; } foreach ( $system_actions as $system_action ) { if ( $system_action['code'] === $action_code ) { return $system_action['integration']; } } global $wpdb; // Integration is not active ... get integration from DB return $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'code' AND meta_value = %s ) AND meta_key = 'integration'", $action_code ) ); }
Expand full source code Collapse full source code View on Github