Skip Navigation

[Résolu] Views parametric search + memcached = empty search fields/dropdowns in form

This support ticket is created Il y a 8 années et 4 mois. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Marqué : 

This topic contains 5 réponses, has 2 voix.

Last updated by Sanny Il y a 8 années et 4 mois.

Assisted by: Luo Yang.

Auteur
Publications
#353596

It seems impossible to make Views form (parametric search) work with memcached (or even just WP Super Cache).

No matter if I use auto_fill parameter for Types fields or not, or simply a taxonomy field, the dropdowns, the options of the dropdowns are always empty in the form.

Please advise a fix and/or give instructions on how to check Views caching/output (debug) so we can tweak it and make this work.

#353604

Actually, the issue is specifically when using object-cache.php, inside wp-contents (needed to make memcached work and also used by W3TC).
https://wordpress.org/support/topic/disable-object-cache
https://codex.wordpress.org/Class_Reference/WP_Object_Cache

Im trying to use Views debug, but no popup appears with debug info (after activating it), from a page with the Views form.
Instead, in the console I get:

TypeError: $j.browser is undefined
if (($j.browser.safari || $j.browser.webkit) && window.console) {

Could you maybe advise on how to programmatically delete the cached data generated by the Views form, through a function that uses wp_cache_delete( $key, $group )?

#353656

Digging more into the code, I found:

// file wp-views/embedded/inc/wpv.class.php
// function short_tag_wpv_view_form

        // Shall we look up in the cache? Is this a Parametric Search View?
        $is_cacheable = $this->is_cacheable( $id ) && $this->does_view_have_form_controls( $id );
        $cache_id = $this->get_cache_id( $id );
        $target_id = $atts['target_id']; // int, > 0
        if( $is_cacheable ) {
            
            // Is it cached?
            $cached_filter_index = get_option( 'wpv_transient_viewform_index', array() );
            $is_cached = isset( $cached_filter_index[$cache_id] ) && $cached_filter_index[$cache_id];
            
            if( $is_cached ) {
                
                $trasient = 'wpv_transient_viewform_'.$cache_id.'_'.$target_id; // strlen() <= 45
                $cached_filter = get_transient( $trasient );
                if( $cached_filter !== false ) {
                    array_pop( $this->view_shortcode_attributes );
                    return $cached_filter;
                }
                // We should not reach this line if everything is working fine
                // But if not, let's continue
            }
            
        }

There should be a way to programmatically disable this, so we can assign a $is_cachable = false to a specific view.
Also, there might be a bug in the way the transient is cached/retrieved, since the form fields' options are missing completely in the form.

Please advise, this is urgent.

#353678

https://toolset.com/errata/views-features-affected-by-servers-who-change-the-wp-object-cache/

Apparently, after wasting hours on debugging, I had to switch to "Always show all values for inputs" and now the dropdowns show their options finally.

However your issue (in the link) is NOT correct/complete.
Our server doesnt change anything, we are using memcached and this object-cache.php (as many other people) hidden link
Also, even logged in users have that problem.

It could be that object-cache isnt updated and causing issues, however since it's the only one available atm and lots of people use it, it would be great if you could either contribute to it, suggest an alternative (hidden link maybe?) or/and provide a fix for that case in your code.

#353787

Dear Sanny,

1) The plugin you are using: Memcached Object Cache
https://wordpress.org/plugins/memcached/
This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

It is not recommended to use such a outdated plugin.

2) There is build-in cache feature in views:
https://toolset.com/documentation/views-shortcodes/#wpv-view
attributes: cached (opt):
Turns off the caching system for the View.

3) here is a document about "Working with Caching Plugins":
https://toolset.com/faq/working-with-caching-plugins/

Hope it help

#353899

The caching option for the view isnt useful in this case (turning it off completely would impact the overall experience badly).
The issue occurs only in the form fields of parametric search, as reported also in YOUR open issue here https://toolset.com/errata/views-features-affected-by-servers-who-change-the-wp-object-cache/ so you ARE aware of the issue (nothing to do with other outdated plugins.....)

We already moved to an updated object-cache file, still Views has the same issue.

W3TC is updated, still Views has issues with it apparently... so it would be a great idea for you to look better into how YOU are caching things, because it might not be ideal for memcached/object caching in general.
Caching methods arent going to change just because Views doesnt like it.

Also, better & more detailes Toolset technical documentation (for developers), with articulated examples and workaround for known issues, would be useful.

Thank you

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.