ninja_forms_get_form_by_field_id

Get a form by field id.

Description

ninja_forms_get_form_by_field_id( (int) $field_id ); 

Parameters (1)

0. $field_id (int)
The field id.

Usage

  1. if ( !function_exists( 'ninja_forms_get_form_by_field_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/deprecated.php'; 
  3.  
  4. // The field id. 
  5. $field_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_get_form_by_field_id($field_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/deprecated.php  
  1. function ninja_forms_get_form_by_field_id( $field_id ) { 
  2. global $wpdb; 
  3. $form_id = $wpdb->get_row($wpdb->prepare("SELECT form_id FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE id = %d", $field_id), ARRAY_A); 
  4. $form_id = $form_id['form_id']; 
  5. $form = ninja_forms_get_form_by_id( $form_id ); 
  6. return $form;