Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Logged-In Users panel #768

Closed
raamdev opened this issue May 14, 2016 · 13 comments
Closed

Improve Logged-In Users panel #768

raamdev opened this issue May 14, 2016 · 13 comments

Comments

@raamdev
Copy link
Contributor

raamdev commented May 14, 2016

When Logged-In Users caching is disabled (the default), everything else in that panel (other than the option to enable Logged-In Users caching) should be greyed out, as none of the other options are applicable unless Logged-In Users caching is enabled. (This should work the same way the HTML Compressor panel works.)

2016-05-14_13-30-34

While we're at it, the Enable HTML Compression for Logged-In Users? option from the HTML Compressor panel should be moved to the Logged-In Users panel, as it seems more appropriate there.

2016-05-14_13-33-03

@raamdev
Copy link
Contributor Author

raamdev commented May 17, 2016

Noting that this is complicated by the when_logged_in option having one of three possible values: 0, 1, and postload. (The ability to choose the value of 1 was dropped a long time ago and only exists for backwards-compatibility.) The JavaScript that is used by the HTML Compressor panel to fade out additional options currently looks for an integer value of >= 1, which does not work with a value of postload.

So, we'll either need to change the when_logged_in option so that instead of using postload it uses, perhaps, 2, or we'll need to adjust the JavaScript to consider the postload value. If we change the postload value, we'll need to write a Version Upgrade routine to change the value for existing sites who may have that option enabled.

@jaswrks
Copy link

jaswrks commented May 17, 2016

The JavaScript that is used by the HTML Compressor panel to fade out additional options currently looks for an integer value of >= 1, which does not work with a value of postload.

Working Around This Issue

  • In the select tag add data-enabled-strings="1,postload"

  • Replace these lines with the following:

    plugin.enableDisable = function (event) {
        var $this = $(this),
        thisValue = $this.val(),
        thisName = $this.attr('name'),
        thisEnabledStrings = String($this.data('enabledStrings') || '1,2,3,4,5').split(/,+/);
    
        var enabled = $.inArray(thisValue, thisEnabledStrings) !== -1;

@raamdev raamdev assigned raamdev and unassigned renzms May 17, 2016
@raamdev
Copy link
Contributor Author

raamdev commented May 17, 2016

@jaswsinc Thanks! :-)

You have a couple of bugs in that outline:

  • "Replace these lines with the following"; doing that breaks the rest of the JavaScript below that section because these lines are part of the previous var statement.
  • The outline does not completely solve the problem, because this line attaches plugin.EnableDisable only to select elements whose name ends with _enable ('select[name$="_enable\\]"]'), and the Logged-In Users option does not end with _enable (its value is when_logged_in). (I was banging my head against the table trying to figure out why the heck it wasn't working.)

So, do you suggest adding a second line that attaches when_logged_in to plugin.EnableDisable, or something else?

@renzms
Copy link

renzms commented May 17, 2016

@raamdev

Hi Raam, are there things that need to be addressed first before I start working on this?

@jaswrks
Copy link

jaswrks commented May 17, 2016

because these lines are part of the previous var statement.

Copy. I missed that, sorry :-)

plugin.EnableDisable only to select elements whose name ends with _enable ('select[name$="_enable]"]'), ... So, do you suggest adding a second line that attaches when_logged_in to plugin.EnableDisable, or something else?

We could alter the select so that it includes an explicit attempt to include the enable/disable functionality on a given <select> tag. So for instance, we can change this line to the following:

$('select[name$="_enable\\]"], select[data-toggle~="enable-disable"]', plugin.$menuPage).not('.-no-if-enabled').on('change', plugin.enableDisable).trigger('change');

and then on the <select> tag add the following attributes here.

data-toggle="enable-disable" data-enabled-strings="1,postload"

Example:

echo '      <p><select name="'.esc_attr(GLOBAL_NS).'[saveOptions][when_logged_in]" data-toggle="enable-disable" data-enabled-strings="1,postload">'."\n";

@raamdev
Copy link
Contributor Author

raamdev commented May 17, 2016

@renzms writes...

Hi Raam, are there things that need to be addressed first before I start working on this?

I've assigned this to myself and already submitted a PR, so I'll take care of this one. :-)

raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue May 17, 2016
@raamdev
Copy link
Contributor Author

raamdev commented May 17, 2016

@jaswsinc writes...

select[data-toggle~="enable-disable"]

Ah, brilliant! Nice. I'm loving those data attributes.

Your suggestions above (see wpsharks/comet-cache-pro@93d37f7) fixed the issue and now toggle works as expected. Woohoo! Thanks. :-)

@jaswrks
Copy link

jaswrks commented May 17, 2016

Awesome :-) One last thing I just noticed is that we might need to include 2 here also. Not sure about that, but I'm guessing you will know more since you're working closely with that at the moment.

I'm thinking maybe:

data-enabled-strings="1,2,postload"

@raamdev
Copy link
Contributor Author

raamdev commented May 17, 2016

I just noticed is that we might need to include 2 here also.

No, the possible values for when_logged_in are 0|1|postload; see this line.

@jaswrks
Copy link

jaswrks commented May 17, 2016

Ah, OK.

raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue May 17, 2016
raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue Jun 3, 2016
This follows the Pro Preview behavior of other Pro-only options like
the HTML Compressor and the Auto-Cache Engine.

Related: wpsharks/comet-cache#768
@raamdev
Copy link
Contributor Author

raamdev commented Jun 3, 2016

The following was applied to both the Logged-In Users panel and the Client-Side Caching panel:

2016-06-03_19-17-49
2016-06-03_19-17-59

Additionally, the "Enable HTML Compression for Logged-In Users?" option has been relocated from the HTML Compressor option panel to the more appropriate Logged-In Users option panel:

2016-06-03_19-19-25

@raamdev
Copy link
Contributor Author

raamdev commented Jun 3, 2016

Next Release Changelog:

  • UI Enhancements: Improved the Logged-In Users and the Client-Side Caching options panels to dim additional options when the feature is disabled. Additionally, the "Enable HTML Compression for Logged-In Users?" option has been relocated from the HTML Compressor option panel to the more appropriate Logged-In Users option panel. See Issue #768.

@raamdev raamdev closed this as completed Jun 3, 2016
raamdev added a commit that referenced this issue Jul 7, 2016
- **New Feature! Apache Optimizations.** This release includes a completely new option panel for Apache Performance Tuning. Current options for Apache tuning include GZIP Compression, Leverage Browser Caching, Enforce Canonical URLs, and Send Access-Control-Allow-Origin Header (for Static CDN Filters). These options automatically add or remove from your `.htaccess` file the appropriate configuration based on the options you enable or disable (all options are disabled by default, so your `.htaccess` file is not modified unless you say so). If you prefer to update your `.htaccess` file manually, the necessary configuration can be viewed beneath each option. Props @jaswsinc, @renzms. See [Issue #789](#789).
- **New Feature!** A new "Enable GZIP Compression" option has been added to the new Apache Optimizations panel. This option will automatically add the appropriate configuration to your `.htaccess` file to enable GZIP compression. This option is disabled by default. The old "GZIP Compression" panel has been removed in favor of the new option inside Apache Optimizations. Props @renzms, @jaswsinc. See [Issue #764](#764).
- **New Feature!** Multisite Host Exclusion Patterns. It's now possible to exclude entire sites from the cache in a Multisite Network environment. Domain mapping is also supported! See _Comet Cache → Plugin Options → Host Exclusion Patterns_. If you're running a Multisite Network with Sub-Directories, you can exclude sites using the existing URI Exclusion Patterns feature. Props @kristineds. See [Issue #754](#754).
- **New Feature (Pro)!** A new "Leverage Browser Caching" option has been added to the new Apache Optimizations panel. This option will automatically add the appropriate configuration to your `.htaccess` file to enable Browser Caching. This option is disabled by default. Props @renzms, @jaswsinc. See [Issue #764](#764).
- **New Feature (Pro)!** A new "Enforce Canonical URLs" option has been added to the new Apache Optimizations panel. This options adds the appropriate `.htaccess` code to enforce the correct canonical URLs according to your WordPress Permalink settings (Comet Cache detects if the Permalink Structure ends with a trailing slash, or without a trailing slash). Props @renzms, @jaswsinc. See [Issue #554](#554).
- **Bug Fix**: In some scenarios the Cron Event that cleans up expired cache files (`_cron_comet_cache_cleanup`) would never run, or the Next Run time would constantly reset to 1 minute away from running every time a page was reloaded. We suspect this is a race condition and in attempt to work around this issue we now skip all of our Cron-related checks if Cron is currently in the middle of running a process. Props @xberg and @lkraav for help reporting. See [Issue #653](#653).
- **Bug Fix**: If your site uses aliased domains, Comet Cache now properly considers all possible domain variations when it clears the cache on WP Standard installations. Props @kristineds, @jaswsinc, @yoffe, and @VR51. See [Issue #608](#608).
- **Bug Fix** (Pro): Fixed a bug where Comet Cache would appear to prevent WordPress from redirecting Permalinks that don't include a trailing slash, to the URL that does include a trailing slash. This was due to the fact that Comet Cache loads very early on (for caching purposes) and as a result the WordPress `redirect_canonical()` function never gets run. This was fixed by adding an option to the new Apache Optimizations panel that allows you to Enforce Canonical URLs. Props @renzms, @jaswsinc. See [Issue #554](#554).
- **UX Bug Fix** (Pro): If you had your WordPress Dashboard login details saved by your browser, the browser autofill would automatically fill in the Pro Plugin Updater fields with those details, which then needed to be replaced with your actual Pro license details. The browser autofill has been disabled for those fields (tested in Chrome, Firefox, and Safari). Props @renzms. See [Issue #741](#741).
- **Enhancement**: Added links the Options Page for the Comet Cache [Twitter](http://twitter.com/cometcache) and [Facebook](http://facebook.com/cometcache) accounts. Props @renzms. [Issue #771](#771).
- **Enhancement:** Added full support for UTF-8 (multibyte strings). This release adds full support for UTF-8 throughout the Comet Cache codebase, greatly enhancing Comet Cache's ability to deal with file paths and URLs that may contain UTF-8 characters. Props @jaswsinc. [Issue #703](#703).
- **UI Enhancements**: Improved the Logged-In Users and the Client-Side Caching options panels to dim additional options when the feature is disabled. Additionally, the "Enable HTML Compression for Logged-In Users?" option has been relocated from the HTML Compressor option panel to the more appropriate Logged-In Users option panel. See [Issue #768](#768).
- **UX Enhancement**: Improved the inline docs for Auto-Clear List of Custom URLs to clarify that full URLs must be provided. Props @renzms. See [Issue #781](#781).
- **Enhancement** (Pro): The Pro Plugin Updater has been improved to allow for better compatibility with hosting platforms that use Apache's ModSecurity. In some cases, site owners were seeing a 404 error when attempting to update the Pro version using the Pro Plugin updater because certain ModSecurity rules were blocking the Pro Updater requests. The Pro Plugin Updater now uses WP Transients to store the necessary metadata, which works around the issue with ModSecurity. Props to @seozones for reporting and @jaswsinc for help fixing this. [Issue #416](#416).
- **Enhancement** (Pro): When Static CDN Filters are enabled, it's now possible to disable the automatic insertion of rules into your `.htaccess` file that are designed to prevent issues with [CORS](https://cometcache.com/kb-article/what-are-cross-origin-request-blocked-errors/). See _Apache Optimizations → Send Access-Control-Allow-Origin Header?_ See [Issue #787](#787).
- **Enhancement** (Pro): The HTML Notes added to the bottom of a cached page now specify if the page was cached as the result of an HTTP Request or if it was cached by the Auto-Cache Engine. Props @kristineds. See [Issue #292](#292).
- **Enhancement** (Pro): The Auto-Cache Engine now supports a fallback to cURL using the WP HTTP API. If your PHP configuration has `allow_fopen_url=0`, the Auto-Cache Engine will use the fallback to download the XML Sitemap and parse it from a temporary file. If you want to force the use of this fallback even when `allow_fopen_url=1`, you can use [a filter](#440 (comment)). See [Issue #440](#440).
- **UI Enhancement** (Pro): A second button has been added to the bottom of the Pro Plugin Updater page that allows you to "Save and Update Comet Cache Pro" in one step. Props @renzms. See [Issue #741](#741).
- **UI Enhancement** (Pro): The "Cache Stats" button in Admin Bar is now linked to the Cache Stats page. Instead of hovering over the button and then clicking "More Info" inside the popup panel, you can now just click the "Cache Stats" button to go directly to the Cache Stats page. Props @Presskopp, @renzms. See [Issue #780](#780).
- **Comment Mail Compatibility:** Improved compatibility with the Comment Mail plugin by automatically clearing the cache whenever Comment Mail options are changed. Many of the Comment Mail options affect front-end portions of the site, so it's important that the cache is cleared whenever Comment Mail options change. See [Comment Mail Issue #278](wpsharks/comment-mail#278 (comment)).
- **PHP Compatibility:** Improved compatibility back to PHP 5.2 (the lowest version allowed by WordPress). Comet Cache still requires PHP 5.4+, but if you install Comet Cache on a site running PHP 5.2, it will now fail gracefully with a Dashboard notice indicating PHP 5.4+ is required, instead of producing a fatal error. See [Issue #784](#784).
- **WP-CLI Compatibility**: Fixed a bug with deactivating Comet Cache using WP-CLI. Doing so was producing a "Invalid argument; host token empty!" error message. This has been resolved. Props @MarioKnight @jaswsinc @renzms. See [Issue #728](#728).
- Renamed `COMET_CACHE_ALLOW_BROWSER_CACHE` constant to `COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE`. Backwards compatibility has been maintained.
- Renamed `allow_browser_cache` plugin option to `allow_client_side_cache`.
@raamdev
Copy link
Contributor Author

raamdev commented Jul 7, 2016

Comet Cache v160706 has been released and includes changes from this GitHub Issue. See the v160706 announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#768).

@wpsharks wpsharks locked and limited conversation to collaborators Jul 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants