Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot Fix: Prevent fatal error on save posts or pages with [give_multi_form_goal] shortcode #7061

Merged
merged 5 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions give.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
* Author: GiveWP
* Author URI: https://givewp.com/
* Version: 3.0.2
* Version: 3.0.3
* Requires at least: 6.0
* Requires PHP: 7.2
* Text Domain: give
Expand Down Expand Up @@ -391,7 +391,7 @@ private function setup_constants()
{
// Plugin version.
if (!defined('GIVE_VERSION')) {
define('GIVE_VERSION', '3.0.2');
define('GIVE_VERSION', '3.0.3');
}

// Plugin Root File.
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 7.2
Stable tag: 3.0.2
Stable tag: 3.0.3
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -262,6 +262,9 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri
10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on.

== Changelog ==
= 3.0.3: October 20th, 2023 =
* Fix: Using the multi-form shortcode with the ids attribute no longer causes a fatal error

= 3.0.2: October 19th, 2023 =
* Fix: Stripe per-form settings are included when migrating a form to the Visual Donation Form Builder
* Fix: Gateways are properly separated in the settings page and Global Settings for Fee Recovery shows all gateways when you select per gateway
Expand Down
8 changes: 7 additions & 1 deletion src/MultiFormGoals/MultiFormGoal/Shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function addShortcode()
/**
* Returns Shortcode markup
*
* @since 3.0.3 Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus
* @since 2.9.0
**/
public function renderCallback($attributes)
Expand All @@ -49,7 +50,12 @@ public function renderCallback($attributes)

$multiFormGoal = new MultiFormGoal(
[
'ids' => array_map('_give_redirect_form_id', $attributes['ids']),
'ids' => array_map(
static function ($id) {
_give_redirect_form_id($id);
},
$attributes['ids']
),
'tags' => $attributes['tags'],
'categories' => $attributes['categories'],
'goal' => $attributes['goal'],
Expand Down
3 changes: 2 additions & 1 deletion src/MultiFormGoals/ProgressBar/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(array $args)
/**
* Get forms associated with Progress Bar
*
* @since 3.0.3 Return empty array instead of false
* @since 2.9.0
*/
public function getForms(): array
Expand Down Expand Up @@ -78,7 +79,7 @@ public function getForms(): array

return $query->posts;
} else {
return false;
return [];
}
}

Expand Down
Loading