slaFFik / buddypress-groups-extras

Adding missing functionality to BuddyPress Groups.
https://wordpress.org/plugins/buddypress-groups-extras/
13 stars 12 forks source link

Clean post cache after field save. #103

Open boonebgorges opened 8 years ago

boonebgorges commented 8 years ago

When running a persistent object cache like Memcached, edits to custom group fields do not "stick". That is: you go to the Manage tab, enter a new value for the tab, and save changes; when the page reloads, the old value appears instead of the new one.

The reason is that you're using $wpdb->update() rather than wp_update_post() to save the field value, and $wpdb->update() doesn't flush the cached post. You have to do it manually.

I see a small handful of other places in the plugin where you're modifying core tables using $wpdb->query() - it looks like they're all deletions. All of these will also leave behind a stale cache, though perhaps in the case of deletion it's not so critical to clear the caches.

slaFFik commented 8 years ago

Thanks for a PR!

I don't remember, why I use $wpdb->update(), and not wp_update_post(). It was like 4 years ago decision (or something). Perhaps, to eliminate post_author problem, when publishing a CPT from a user with no valid capabilities.

For v3.7 I will try to revisit this whole thing, no ETA though.

@boonebgorges Do you want 3.6.9.1 or 3.6.10 with this fix to be released? I can take a look and perhaps add cache clearing functions in other places as well, as a somewhat temporary solution.

boonebgorges commented 8 years ago

Do you want 3.6.9.1 or 3.6.10 with this fix to be released? I can take a look and perhaps add cache clearing functions in other places as well, as a somewhat temporary solution.

It's up to you, of course :) For the client site that's having the trouble, I will put in a hotfix. I'd suggest that, if you do a minor release in the near future, you include my PR; but it's certainly not so severe that you need to prepare a release just for this purpose.

slaFFik commented 1 week ago

This will be included in the 3.7.0. But I am adding a bit more of those things in other places, plus the main branch diverted a bit, so I can't merge the PR directly.