Skip Navigation

[Resolved] GiveWP and Toolset conflict

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 21 replies, has 3 voices.

Last updated by Christopher Amirian 1 year, 4 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2625167

Quick update. The support team at GiveWP says they are not likely to fix this on their side as it is the only reported problem related to how they do things and they'd have to go through all of their code to make sure they don't break anything in their core plugin and all their add-ons plus 3rd party code if they did change it. I asked them to reconsider but right now it looks like I, and about 20 of my clients, are caught in the middle of Toolset and GiveWP each saying the other should fix this issue.

#2625195

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you for informing us. As mentioned, the development team's decision was to set this one as won't fix due to reasoning already mentioned by my colleague.

The only thing that I can suggest here is to keep track of the workaround on your client's website whenever there is a new update.

Thank you.

#2625337

Thanks Christopher. I understand the developers' decision. I just wanted them to know that GiveWP is making a similar decision for similar logic on their side and we customers are stuck in the middle without a real solution to this problem. I've told GiveWP's support the same thing. I have over 20 clients that I've used Toolset and Give for. If neither company is willing to fix this issue, I will likely have to figure out how to remove one or both of your products from those sites as the cost of me having to watch for updates and re-apply a work-around over and over again will either destroy any profit I have in my maintenance plans or push the cost of those plans too high for these nonprofit customers.

#2625341

Where did your developers find that the WordPress documentation says an empty array is always expected?

It says "An empty string if a valid but non-existing post ID is passed." in the official developer documentation here:
https://developer.wordpress.org/reference/functions/get_post_meta/#return

#2625363

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

An empty string is only expected in the case where a "valid but non-existing post ID is passed".

That doesn't apply when a valid post ID is passed, when an empty array is expected.

Without GiveWP that's exactly what is returned.

GiveWP modifies this core behaviour by hooking in to the get_post_metadata filter and changing what is returned in this scenario to an empty string from the standard empty array.

When we raised this with them they replied "we should be respecting the return types of WP API hooks and I'll bring this to the team so that we can incorporate this into our work on 8.0 compatibility", so our understanding is that they will fix this in a future update.

#2627155

So far they are still saying they won't fix it so we're stuck in the middle of both companies pointing at each other with neither solving the customer's problem. I understand the logic in both cases but it doesn't make things any better for my clients.

#2627401

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

I'm sorry to hear that, given that GiveWP led us to believe they would fix this as part of their work on PHP 8 compatibility, and the case for not modifying core WordPress functions seems unarguable. In which case you'll need to patch either Toolset—as described previously—or GiveWP, so that it returns an empty array as expected rather than an empty string".

If you decide to do it on WP Give side you can change the file:

plugins/givewp/includes/database/class-give-db-meta.php lines 151 to 153

To:

if ( $this->raw_result ) {
            if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) {
                $value = [];
            }

Thanks.