From 8479efc51ec8436a5cfe265858ed9577f9c7f558 Mon Sep 17 00:00:00 2001 From: asus Date: Tue, 16 Apr 2024 14:19:14 +0200 Subject: [PATCH] added protection for first post --- plugins/fbpatch/fbpatch.php | 2 +- plugins/fbpatch/php/patches/hide_show.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/fbpatch/fbpatch.php b/plugins/fbpatch/fbpatch.php index 41c413c..6f6f8b2 100644 --- a/plugins/fbpatch/fbpatch.php +++ b/plugins/fbpatch/fbpatch.php @@ -4,7 +4,7 @@ Plugin Name: hggg_fbpatch Plugin URI: Description: some patchs for the form_builder plugin's bugs Author: hugogogo -Version: 0.2.0 +Version: 0.2.1 Author URI: */ diff --git a/plugins/fbpatch/php/patches/hide_show.php b/plugins/fbpatch/php/patches/hide_show.php index a9328bc..38a06f6 100644 --- a/plugins/fbpatch/php/patches/hide_show.php +++ b/plugins/fbpatch/php/patches/hide_show.php @@ -24,7 +24,7 @@ if (!defined('ABSPATH')) { function form_partner_before_process($form_id, $post_array, $form_type) { //error_log("post_array: " . json_encode($post_array)); - if (is_null($post_array) || empty($post_array)) { + if (empty($post_array)) { //nothing to overwrite return Fbpatch::set_post_elements_to_forget(0, false, array()); } @@ -32,6 +32,10 @@ function form_partner_before_process($form_id, $post_array, $form_type) { //nothing to overwrite return Fbpatch::set_post_elements_to_forget(0, false, array()); } + if (!isset($post_array['ID']) || empty($post_array['ID'])) { + //nothing to overwrite + return Fbpatch::set_post_elements_to_forget(0, false, array()); + } /*