Forum Replies Created

Viewing 15 replies - 136 through 150 (of 336 total)
  • Thread Starter CodeBard

    (@codebard)

    Might work, but how is that exactly going to work?

    If that function is called during a page load, Fastest Cache will not serve the page from the cache or something?

    Thread Starter CodeBard

    (@codebard)

    Much appreciated. Looking forward to it.

    Thread Starter CodeBard

    (@codebard)

    Unfortunately, manual exclusion of a page would not work in our case. We want to automatically (programmatically) exclude certain pages which our users gate/lock to be only for members. So when a user gates a post to be only for members, we need to have a way to tell WP Fastest Cache that it shouldnt cache that page during page load.

    Something like DONOTCACHEPAGE to prevent the page from being cached, or better, something like WPSC_SERVE_DISABLED flag of WP Super Cache that prevents serving a cached page and instead loads the live version.

    Plugin Author CodeBard

    (@codebard)

    Great to hear. Good luck with your patrons.

    Plugin Author CodeBard

    (@codebard)

    @mrshawntierney Pixelprism has not responded since then.

    Since this affects Patron Pro, a premium plugin, you can bring this issue to Codebard help desk to get it resolved. Just visit help desk below and post a ticket and lets see whats wrong.

    https://codebard.com/help-desk

    Plugin Author CodeBard

    (@codebard)

    In that case, please visit Codebard help desk at https://codebard.com/help-desk and post a support ticket on this with the details.

    Plugin Author CodeBard

    (@codebard)

    Notice that this plugin is free – i think you are confusing Patron Pro with Patreon Button Widgets and Plugin (this one).

    Plugin Author CodeBard

    (@codebard)

    Can you use your editor if you disable Organic Widgets Editor plugin?

    Plugin Author CodeBard

    (@codebard)

    Im unable to reproduce this with WP 5.3, v 2.0.9 of the plugin, Classic Editor (latest), and PHP 5.6, 7.0, 7.1, and 7.2.

    Which versions of Classic Editor, Patron Button and Widgets and PHP you have?

    Do you see any errors in your browser’s console when you hit F12, reload the page and click on ‘Console’ tab?

    Plugin Author CodeBard

    (@codebard)

    Looking into this. I will update this thread with results.

    Plugin Contributor CodeBard

    (@codebard)

    Below code should work – this should be added to some other custom plugin:

    add_filter( ‘ptrn/lock_or_not’, ‘patreon_modify_gating_logic’, 10, 4 );

    function patreon_modify_gating_logic( $lock_or_not, $post_id, $declined, $user ) {

    // This function modifies the gating decision based on conditions. $lock_or_not is an array

    // Introduce check for roles of user like editor, subscriber or others.
    // Depending on the condition modify the gating decision array.

    $user = wp_get_current_user();
    if ( in_array( ‘editor’, (array) $user->roles ) ) {
    $lock_or_not[‘lock’] = false;
    $lock_or_not[‘reason’] = ‘show_to_admin_users’;
    }

    return $lock_or_not;
    }

    • This reply was modified 6 years, 6 months ago by CodeBard.
    Plugin Contributor CodeBard

    (@codebard)

    First, please note that we provide support for the plugin at the official forum:

    https://www.patreondevelopers.com/c/patreon-wordpress-plugin-support

    That being said, admins should already have automatic access. What level of users do you want to give access to gated content?

    Plugin Contributor CodeBard

    (@codebard)

    Hooking to the end of the_content by maxing out the priority variable and using Patreon WordPress lock_or_not function on post id to check if the post should be gated, and based on the result wrapping the output in ESI code may work i believe?

    <esi:inline name=”/gated”>
    gated content here
    </esi:inline>

    … orsomething similar? Im not familiar with Litespeed or ESI.

    – Caching only for non-logged-in users. Logged-in users see uncached version of the pages.

    Making caching for non logged in users only could definitely reduce the load while also mitigating ‘content doesnt unlock’ issues. Even if it may occasionally cause newly gated or un-gated content to appear at the opposite state to anonymous visitors. We may look into this and experiment with it for future releases.

    Plugin Contributor CodeBard

    (@codebard)

    Current cache override mechanism works by setting up common WP cache related flags, and sending one HTTP cache header. To recognize these flags and process them is something that depends on caching plugins, server side caching software, CDNs, ISP proxy caches and users’ devices/browsers. At any point these flags may be ignored by caching software, however any software built and configured up to standards would likely respect the flags.

    This feature can be turned on or off in Patreon Settings menu. Default is on, if you turn it off it will just go away. Any conflict should go away as well.

    This feature was added to prevent gated content from being cached so that when a patron unlocks a gated content he or she would not end up with a stale cached version of the content. Or, vice versa – a non-patron still accessing content s/he lost access to. This was causing pretty difficult to track support cases that went like “content doesnt unlock”, “locking doesnt work”, “Patreon doesnt work” and it was very confusing for creators and users alike.

    For the code technicals:

    Two methods in Patreon_Compatibility class set the flags for gated content.

    set_do_not_cache_flag_for_gated_content method sets flags for internal WP code. The flags are each well commented so you can immediately see which plugin or flag do they belong to and search the flag via plugin documentation or just Google it.

    Main one is DONOTCACHEPAGE that is common throughout WP ecosystem. It tells caching plugins to not cache the page. How the plugin does ‘not’ cache the content is up to itself.

    Then there are a few specific flags for specific plugins. Like WPSC_SERVE_DISABLED to tell WP Super Cache to not use cached version of a gated content if cached version already exists. Otherwise with only DONOTCACHEPAGE flag WP Super Cache does not cache non-cached gated content when it is processing the cache, but if there is already a cached version, it just uses the cached version. WPSC_SERVE_DISABLED flag bypasses it entirely.

    Its similar for other flags related to W3 Total Cache and Litespeed cache plugins.

    modify_headers method in the same class sets a HTTP header no cache flag if the content is gated:

    Cache-control: private, max-age=30, no-cache

    This should tell every CDN, ISP proxy or device/browser that sees that header to avoid caching the content long time, and every device to revalidate the content if the version it has is older than 30 seconds. This should prevent hitting the server again if the user refreshes or goes back-forth immediately, but it should be short enough that a patron who lost access to some content should not access that content.

    Now, dealing with not caching the gated part of the content and leaving rest of the page cached. That’s a bit complicated.

    The gating happens by replacing the content with a gated content interface by hooking to the_content filter with very low priority number to ensure the gating kicks in last. So far so good.

    But since there is nothing being done out of the ordinary WP hooks/filters, the content would behave like normal WP content and caching should work as it works for every other WP content at a given site.

    So since i dont know what kind of server side caching you are using, im just going to hypothesize and use a makeshift example:

    One way i can think of for doing that would be to use a server side cache or a cache plugin that allows compartmentalized caching of pages. Then somehow check whether the content is gated, and if so, leave the content part of the page not cached. Or however caching can be compartmentalized.

    For this it must be checked that the post is gated or not. To have this happen server side will either involve triggering WP code (kinda beats the purpose) or using PHP or other code with Patreon API or a local cached version of patrons/pledges and decide whether to use caching or not depending on content being gated. That also beats the purpose since it could add some server load.

    A best way can be to use a WP cache plugin’s any compartmentalized cching feature, and set up a flag for that plugin to not cache content part of a page if the content is gated. So every time that page is loaded, every part of the page will come from cache but the content part.

    Anything that allows you to leave out caching for the content part of a specific page from server side cache will just work.

    If you give more info on what kind of caching setup you have, something more relevant can be suggested.

    I personally recommend finding a way to not cache gated content – at least the content part. And any other patron-specific part like dynamic widgets related to Patreon etc. Otherwise many patrons seem to encounter erratic ‘content does not unlock’ issues which come up and go away on their on depending on the behavior of caching at a given site.

    Also s a sidenote – we provide support at official forum at https://www.patreondevelopers.com/c/patreon-wordpress-plugin-support

    Plugin Contributor CodeBard

    (@codebard)

    How have you created your app? Via the setup wizard, or manually?

    Additionally, please use the official forum for support needs:

    https://www.patreondevelopers.com/c/patreon-wordpress-plugin-support

Viewing 15 replies - 136 through 150 (of 336 total)