Support » Plugin: Patreon WordPress » How to allow access to WP staff.

  • We run this plugin over at our website and while it works well for Patreon members, we’re trying to figure out how to enable access to locked content for our own staff. Obviously it seems silly to have our own staff be forced to contribute via Patreon to access the content they themselves are producing.

    Is there a way to enable access for certain WP user levels or specific WP accounts without them having to contribute via Patreon?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author 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?

    Apologies, I’ll address future concerns to the official forum.

    To answer your question: Editors especially, as this would solve my direct problem, but in a more general sense, the ability to authorize authors/contributors or specific accounts would be extremely useful.

    Plugin Author 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 1 month, 2 weeks ago by CodeBard.
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.