Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Automator_DB_Handler_Closures::get_entry_meta( int[] $args = array(), string $meta_key = '' )

Retrieve an entry meta value from the closures log meta table.


Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Parameters Parameters

$args

(Optional) -- $args Accepts int 'user_id'

  • Defaults to NULL int 'automator_closure_id'
  • Defaults to NULL int 'automator_closure_log_id
  • Defaults to NULL

Default value: array()

$meta_key

(Optional)

Default value: ''


Top ↑

Return Return

(string|false) Returns the meta value as string. Otherwise, returns boolean false if meta value is falsy or if meta key is empty.


Source Source

File: src/core/lib/utilities/db/class-automator-db-handler-closures.php

	public function get_entry_meta( $args = array(), $meta_key = '' ) {
		if ( empty( $meta_key ) ) {
			_doing_it_wrong( esc_html( self::class . '::get_entry_meta' ), 'The parameter $meta_key must not be empty.', 4.12 );
			return false;
		}
		$args = wp_parse_args(
			$args,
			array(
				'user_id'                  => null,
				'automator_closure_id'     => null,
				'automator_closure_log_id' => null,
			)
		);
		global $wpdb;
		$closure_meta_tbl = $wpdb->prefix . Automator()->db->tables->closure_meta;
		$meta_value = $wpdb->get_var(
			$wpdb->prepare(
				'SELECT meta_value FROM ' . esc_sql( $closure_meta_tbl ) . '
				WHERE user_id = %d
				AND automator_closure_id = %d
				AND automator_closure_log_id = %d
				AND meta_key = %s
				',
				$args['user_id'],
				$args['automator_closure_id'],
				$args['automator_closure_log_id'],
				$meta_key
			)
		);
		if ( empty( $meta_value ) ) {
			return false;
		}
		return $meta_value;
	}