Is it possble to programatically control if a page should be paywalled?
It is possible to override the decision of which content should be paywalled. Add a hook to the iteras_override_content_paywall filter to define a function that should have the last say in if the content should be paywalled or not. This can for example be used for handling share links the gives the user access eventhough they don’t have a login. This could look something like this:
/**
* Override the decision to paywall the particular content
*
* @param integer $post_paywall_ids The paywalls that give access to the post, if empty the post would not be paywalled be default
* @param object $post Reference to the post being potentially paywalled
* @param boolean $user_authorized If the user has a valid iteraspass that has the appropriate access
* @param array $paywall_config Contains the Iteras plugin configuration
*/
function make_paywall_decision($post_paywall_ids, $post, $user_authorized, $paywall_config) {
// example of generated share token
error_log(openssl_encrypt(json_encode(array('shared_by'=>"John Doe", 'post_id' => $post->ID)), "aes-128-cbc", "somesecret"));
$token = $_GET['token'];
if (isset($token)) {
$share = json_decode(openssl_decrypt($token, "aes-128-cbc", "somesecret"));
if (isset($share) and $share->post_id == $post->ID) {
echo "Shared by " . $share->shared_by;
// signal that the paywall should not be applied
return false;
}
}
// return the paywall ids to apply the paywall as normal
return $post_paywall_ids;
}
add_filter('iteras_override_content_paywall', 'make_paywall_decision', 10, 4);
My visitors don’t return to the page they came from after having signed up?
When you link to other pages, you may be losing the return information needed to redirect the visitors. Send the URL through [iteras-return-to-page] as described above to forward the return information.
When an iframe is embedded directly, the return information is inserted automatically, but when you put the iframe on another page and link to that, the iframe needs to know where the visitors come from to be able to return them correctly.
Can I do something with this plugin without an ITERAS account?
No. But it’s not hard to get one – if you are interested in learning more about ITERAS, please visit iteras.dk and contact us.
What should I do if the plugin ends up being included multiple times on the same page?
You will need to do a custom integration. The plugin attaches to the the_content hook in WordPress which in some situations is called mutiple times by 3rd party plugins.
In this case set the “Paywall integration method” to “Custom” and add the paywall code manually to the theme or plugin you are using. This can be done either by wrapping the post body with the shortcode [iteras-paywall-content]...[/iteras-paywall-content] or by calling Iteras::get_instance()->potentially_paywall_content(...) which returns the content wrapped with the paywall.
Security issues
If you discover a security issue, please contact us. You can also report it through Patchstack.