ri_set_post_content

The Gravity Forms Data Persistence Add-On Reloaded ri set post content function.

Description

ri_set_post_content( $entry, $form ); 

Parameters (2)

0. $entry
The entry.
1. $form
The form.

Usage

  1. if ( !function_exists( 'ri_set_post_content' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'gravity-forms-data-persistence-add-on-reloaded/gravity-forms-data-persistence-add-on-reloaded.php'; 
  3.  
  4. // The entry. 
  5. $entry = null; 
  6.  
  7. // The form. 
  8. $form = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = ri_set_post_content($entry, $form); 
  12.  

Defined (1)

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

/gravity-forms-data-persistence-add-on-reloaded.php  
  1. function ri_set_post_content( $entry, $form ) { 
  2. if ( gfdp_is_persistent( $form ) ) { 
  3. //Update form data in wp_options table 
  4. $transient_key = ri_gfdp_getFormTransientKeyForGF( $form ); 
  5.  
  6. if ( $form['isEnablePersistentClear'] || $form['ri_gfdp_persist_clear'] ) { 
  7. delete_transient( $transient_key ); 
  8. } else { 
  9. $data = ri_gfdp_sanitize_data( $_POST, $form ); 
  10. set_transient( $transient_key, json_encode( $data ), ri_gfdp_getFormTransientExpiration($form) ); 
  11.  
  12. $entry_option_key = ri_getEntryOptionKeyForGF( $form ); 
  13. if ( get_option( $entry_option_key ) ) { 
  14. //Delete old entry from GF tables 
  15. if ( isset( $form['ri_gfdp_persist'] ) ) { 
  16.  
  17. if ( ! $form['ri_gfdp_multiple_entries'] ) { 
  18. RGFormsModel::delete_lead( get_option( $entry_option_key ) ); 
  19. } else { 
  20. if ( ! $form['isEnableMulipleEntry'] ) { 
  21. RGFormsModel::delete_lead( get_option( $entry_option_key ) ); 
  22.  
  23. //Update entry in wp_options table 
  24. update_option( $entry_option_key, $entry['id'] );