um_admin_pre_save_fields_hook

The Ultimate Member um admin pre save fields hook function.

Description

um_admin_pre_save_fields_hook( $array ); 

Parameters (1)

0. $array
The array.

Usage

  1. if ( !function_exists( 'um_admin_pre_save_fields_hook' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ultimate-member/admin/core/um-admin-filters-fields.php'; 
  3.  
  4. // The array. 
  5. $array = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = um_admin_pre_save_fields_hook($array); 
  9.  

Defined (1)

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

/admin/core/um-admin-filters-fields.php  
  1. function um_admin_pre_save_fields_hook( $array ) { 
  2. global $ultimatemember; 
  3. extract( $array ); 
  4.  
  5. $metabox = new UM_Admin_Metabox(); 
  6.  
  7. $fields_without_metakey = array('block', 'shortcode', 'spacing', 'divider', 'group'); 
  8. $fields_without_metakey = apply_filters('um_fields_without_metakey', $fields_without_metakey ); 
  9.  
  10. $fields = $ultimatemember->query->get_attr('custom_fields', $form_id); 
  11. $count = 1; 
  12. if ( isset( $fields ) && !empty( $fields) ) $count = count($fields)+1; 
  13.  
  14. // set unique meta key 
  15. if ( in_array( $field_type, $fields_without_metakey ) && !isset($array['post']['_metakey']) ) { 
  16. $array['post']['_metakey'] = "um_{$field_type}_{$form_id}_{$count}"; 
  17.  
  18. // set position 
  19. if ( !isset( $array['post']['_position'] ) ) { 
  20. $array['post']['_position'] = $count; 
  21.  
  22. return $array;