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.
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:
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.
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.
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.
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.
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.
The user is not a logged in user. This will cause the post to be locked.
The user was a patron but user’s payment was declined. This will cause the post to be locked.