Support » Plugin: Cloudflare » Anonymous users filters in Hooks.php broken

  • Resolved wpweaver

    (@wpweaver)


    I have latest version of Cloudflare plugin. Have Cloudfrare on MANY sites. Recently converted most to use Flexible SSL.

    All my sites are configured the same, especially the subdomains under my premium CF site.

    But for some reason, only one site breaks the following code in Hooks.php:

    public function __construct()
    {
    $this->config = new Integration\DefaultConfig(‘[]’);
    $this->logger = new Integration\DefaultLogger(false);
    $this->dataStore = new DataStore($this->logger);
    $this->integrationAPI = new WordPressAPI($this->dataStore);
    $this->integrationContext = new Integration\DefaultIntegration($this->config, $this->integrationAPI, $this->dataStore, $this->logger);
    $this->api = new WordPressClientAPI($this->integrationContext);
    $this->proxy = new Proxy($this->integrationContext);

    // Don’t allow “logged in” options to display to anonymous users
    if ($this->isPluginSpecificCacheEnabled()) {
    add_filter(‘show_admin_bar’, ‘__return_false’);
    add_filter(‘edit_post_link’, ‘__return_null’);
    }
    }

    The // Don’t allow “logged in” options to display to anonymous users part is for some reason deciding to add the show_admin_bar and edit_post_link filters even though I’m logged in as the normal admin user to the site and the site uses the same CF credentials as all other sites on my main domain and subdomains.

    I’ve wasted a huge amount of my time tracking this down – and I simply cannot find any difference in my configuration of this one subdomain than any of the other several subdomains on my premium account.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Follow up :

    There must be some issue because I am NOT using the Cache Everything rule, yet the WP Admin bar and Edit Button disappear seemingly randomly.

    I am the author of a theme with tens of thousands of users, and my own support forum is now getting several complaints about this issue.

    This code is NOT working as described in the other threads.

    This is absolutely not acceptable behavior.

    Plugin Contributor thellimist

    (@furkan811)

    Hi @wpweaver,

    > WP Admin bar and Edit Button disappear seemingly randomly

    if ($this->isPluginSpecificCacheEnabled()) {
        add_filter(‘show_admin_bar’, ‘__return_false’);
        add_filter(‘edit_post_link’, ‘__return_null’);
    }

    The setting is not as smart as to check if the user has Cache Everything rule. This code will only run if “Automatic Cache Management” toggle is active. It is not random. Please check your blog if you’ve enabled the setting.

    (FYI That code block will be removed in the next version)

    > But for some reason, only one site breaks

    What do you mean by the site breaks?
    Which part of the site breaks?
    Is there any PHP error logs?
    Any browser console error logs?

    I consider unpredictable behavior and blocking the admin bar and Edit buttons to be broken behavior – even without error messages.

    I have several sites with IDENTICAL configurations running under a premium CF acount, and only ONE site has the problem. This behavior has been duplicated by several of other users of my theme – identical settings, but only one site failing. Since all the relevant settings for the root URL are applied (“Automatic Cache Management”, etc.) to all subdomains of that site, it is troubling that one subdomain has different behavior.

    There is some evidence that enabling https has something to do with the problem. All of the subdomains covered by the main domain have identical CF plugins installed and activated.

    Commenting out the two filters on the CF plugin for the “broken” site solves the issue, but that does not explain why other sub-domains don’t have a problem.

    But if there is a new approach in the next release of the plugin, perhaps this is all irrelevant anyway.

    Plugin Contributor thellimist

    (@furkan811)

    WordPress Cloudflare Plugin 3.2.0 is live fixing the issue. Please use the Bypass Cache By Cookie feature

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Anonymous users filters in Hooks.php broken’ is closed to new replies.