impress-org / givewp

GiveWP - The #1 Donation Plugin for WordPress. Easily accept donations and fundraise using your WordPress website.
https://givewp.com/
GNU General Public License v3.0
344 stars 191 forks source link

fix(donation): Address why donations are saved to the DB as $0 when memcache is enabled on Dreamhost #3199

Closed mathetos closed 6 years ago

mathetos commented 6 years ago

User Story

As a Give Admin who is hosted on Dreamhost's DreamPress package, I expect to be able to use Give effectively with donation data being saved correctly to the database.

In working with @Ipstenu on this, we identified the following:

Each Dreamhost user has the following in common:

Current Behavior

Currently, donations are processed correctly, but when the donor gets to the Donation Confirmation page, it shows the donation total as $0. That is also saved to the database as $0. This means that the only way to get Give to show an accurate amount is to log into my payment processor, get the right amount, update the amount in the Give Donation Details screen (or directly to the database).

This only happens when Deamhost's memcache is enabled.

Expected Behavior

I expect to have the donation total be correctly saved to the database and reflected correctly on the donation confirmation and history pages for the donor as well as in the Donation Details screen.

Possible Solution

Currently, the only workaround is for the user to disable memcache completely. This isn't a viable workaround and will create a lack of faith in Give for any user on this platform.

Steps to Reproduce

I have a test environment from which this can be replicated. #TeamGive developers can ping me for it.

Visuals

The $1 donation was made AFTER memcache was disabled image

Related

The following are for #TeamGive access only

Tasks

DevinWalker commented 6 years ago

Access info on Slack: https://givewp.slack.com/files/U064V9KDJ/FAMFVK98W/Dreamhost_Give_Test_Environment

mathetos commented 6 years ago

@ravinderk Quick update:

I've been testing this Dreamhost issue for days now. Mika and I narrowed it down to NOT just be memcache, but a combo of Give + {mystery plugin/theme} + memcache. Right now, my best lead is that is MIGHT be Avada because that is consistent on both environments I have access to.

mathetos commented 6 years ago

More notes from Dreamhost folks:

So far, I found Avada does a lot of resetting of caches all over the place (you can see ob_start() in a bunch of places) ...there are times when something tries to save too much data into the database, it can overload the cache. Avada can store the CSS in the db - https://theme-fusion.com/avada-doc/special-features/css-compiler/

ravinderk commented 6 years ago

@DevinWalker @mathetos I found the issue is in Avada theme. Basically, it is not good to invalidate each cache element without knowing about it.

Avada theme is invalidating all cache on every save_post and delete_post hook. Which cause of generating bad cache for Give or maybe for other plugin.

Before: Not working with it image

After: This will resolve issue, but need to discuss with Avada support image

Ipstenu commented 6 years ago

Holy schnikes, @ravinderk ! That was a GREAT catch!

ravinderk commented 6 years ago

@mathetos I created a snippet to fix this issue.

for ref: https://github.com/WordImpress/Give-Snippet-Library/blob/master/theme-compatibility/avada-compatibility.md