Skip to content

Instantly share code, notes, and snippets.

View MikevHoenselaar's full-sized avatar

Mike van Hoenselaar MikevHoenselaar

View GitHub Profile
@MikevHoenselaar
MikevHoenselaar / persistent_multipage_forms-reloaded.php
Last active January 20, 2017 23:05
Render persistence data before form output changed to work with populated fields.
```php
// Render persistence data before form output
add_filter("gform_pre_render", "ri_pre_populate_the_form");
function ri_pre_populate_the_form($form) {
if (gfdp_is_persistent($form)) {
$current_page = GFFormDisplay::get_current_page($form["id"]);
if ($current_page == 1) {
$option_key = ri_getFormOptionKeyForGF($form);
if (get_option($option_key)) {
$persistent_info = json_decode(get_option($option_key));