Patreon Plugin Question

Posted in: Newsmag
Post count: 7

I am wanting to implement the patreon plugin and it works EXCEPT with the featured image (video) and I am wanting to hide the video/featured image too. Which template would I chop away at in order to do this.

Here is the patreon spiel (knowing you dont provide support for third party stuff) Just wondering if you could tell me the proper template since there are so many:

Patreon WordPress – how to lock any part of your Website

How to lock any section, page, type of content, or template section through the code

Its possible to lock any section of the site, a widget, some content in widget, some piece of meta value shown in the header, footer, or even remote embedded content displayed somewhere by using custom code blocks and developer toggles.

First, it is necessary to turn on the direct unlock mechanism by setting the below global variable somewhere. This may be in your theme’s functions.php, and better yet, a custom small plugin added and toggled with just the below code:


<?php

/*
Plugin Name: Patreon Dev Plugin
Plugin URI:
Description: Plugin to hold any customizations, hooks, filters, settings for development
Version: 1.0.0
Author: Patreon <platform@patreon.com>
Author URI: https://patreon.com
*/

$GLOBALS['patreon_enable_direct_unlocks'] = true;

This global will allow the plugin to skip security checks that prevent sending users to Patreon without supplying post ids, so you can create and use the unlock interface anywhere without having to lock a post.

Afterwards, the below code can be used anywhere to lock/show content. The below code checks for patronage level, and if it is the amount you set in the function parameters, shows the content. This code can be put into header, or, for example in the theme element that shows webcomics in headers or widgets as meta values.


<?php

// Custom lock
// Get current user if it is not already present
if ( !$user ) {
$user = wp_get_current_user();
}
// Check how much patronage the user has
$user_patronage = Patreon_Wordpress::getUserPatronage();
// Check if user is a patron whose payment is declined
$declined = Patreon_Wordpress::checkDeclinedPatronage($user);

// Set where we want to have the user land at - this can be anything. The below code sets it to this exact page. This page may be a category page, search page, a custom page url with custom parameters - anything

$redir = home_url(add_query_arg($_GET,$wp->request));

// If the user has less patronage than, say, $7, or declined, and is not an admin-level user, lock the post.

if ( ( $user_patronage < 700
OR $declined )
AND !current_user_can( 'manage_options' )
) {
// Generate the unlock interface wherever it is
echo Patreon_Frontend::displayPatreonCampaignBanner(
7,
array( 'direct_unlock' => 7,
'redirect' => $redir
)
);
// the first param (7) and direct_unlock param set the unlock value for this interface. Both need to be provided and be the same
}
else {
?>
<!-- Here you put your patron-only content for the header. At this point the patron will see the unlocked content which will be displayed here. This may be anything - it can be a custom meta value taken from somewhere, an embedded post, an embedded content, even remote content - whatever works -->

<?php

}

?>

Patreon_Frontend::displayPatreonCampaignBanner is the function that generates the interface. The added arguments array allow it to be used outside post context.

Post count: 23312

Hi,

Unfortunately, the theme has not been tested with this kind of plugin and also, we cannot say for sure if it will work or not as expected with the theme, sorry! Also, please notice that we cannot provide support for untested plugins. As a notice, each plugin might interact with the theme core files and causes a lot of unknown issues. To make it a plugin to be tested with our theme, the whole theme or the whole plugin should have to be adjusted if you want to return well results. Also, this is not a simple task and if you are not aware of the steps which are needed to take, in this case, please consider hiring a freelancer/developer to help you because we cannot provide custom work at the moment, sorry!

Thanks for your understanding!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newsmag’ is closed to new topics and replies.