Patreon WordPress Filters
Using the in-built filters, you can modify the behavior of Patreon WordPress extensively, and create any kind of addon which integrates with it, or integrate Patereon WordPress to 3rd party products and services. 

This document includes all the filters included in the plugin.

ptrn/lock_or_not


An important filter, this one allows you to filter the return of the central lock_or_not function which decides whether to lock content, and the reason why.

Provides, in order:

array: An array that provides the lock boolean and the reason with array keys ‘lock’ and ‘reason’.

$post_id: Id of the post which is being locked or shown.

$declined: The declined status of the patron, if applicable

$user: The user object from WordPress

Reason strings used by the plugin

The strings used for returning the reason that a post was locked or shown are explained below:

valid_patron

This means that the logged in user is a patron and fulfills all the requirements of the post lock. The post will be shown to this user along with the valid patron footer.

no_post_id_no_main_query

This means that the plugin bypassed the locking mechanism because it found that no post id was provided to the locking function, and WordPress was not on a page which was doing the main query. Meaning that not only post id was not provided to the function, bu talso the function was not able to get the post id through the $post global. Which means that post cannot be identified and locked, therefore lock_or_not function aborts with the above reason and does not lock whatever content it was provided.

not_active_patron_at_post_date

This means that the user was not a patron at the date the post was posted, and the post has an active patron at post date requirement. Therefore post will be locked.

active_pledge_not_enough

The user is logged in, is a patron, but the active (current) pledge s/he has is not enough. Therefore the post will be locked, since it is a post that was set to lock for a specific amount.

patron_fulfills_total_historical_pledge_requirement

This means that the post has a total historical pledge requirement set, and the user fulfills this requirement. This will bypass all other requirements and will show the post to the user which fulfills this particular requirement.

user_not_logged_in

The user is not a logged in user. This will cause the post to be locked.

payment_declined

The user was a patron but user’s payment was declined. This will cause the post to be locked.