Skip to content

Instantly share code, notes, and snippets.

Avatar
👽
Craft

Jeremy Green greenhornet79

👽
Craft
View GitHub Profile
View leaky-paywall-cancel-description.php
<?php
add_filter('leaky_paywall_cancel_subscription_description', 'endo_change_cancel_description' );
function endo_change_cancel_description( $description ) {
$new_description = '<p>Please click the first link below to cancel your subscription.</p>';
return $new_description;
}
View leaky-paywall-toc-field.php
<?php
// add toc field to registration form
add_action('leaky_paywall_after_password_registration_field', 'zeen_custom_tos_registration_fields');
function zeen_custom_tos_registration_fields()
{
?>
<div class="form-row">
<input style="display: inline;" type="checkbox" required id="tos" name="tos"> <label for="tos" style="display: inline;">I understand I will be automatically billed on my renewal date unless I cancel, and I agree to all <a target="_blank" href="<?php echo home_url('subscription-terms'); ?>">terms and conditions</a>.</label>
View leaky-paywall-hide-nag.php
<?php
add_filter( 'leaky_paywall_subscribe_or_login_message', 'zeen_hide_nag', 20, 4 );
function zeen_hide_nag( $new_content, $message, $content, $post_id ) {
// return either original content or an empty string
// return $content;
return '';
View leaky-paywall-change-role.php
<?php
add_filter( 'leaky_paywall_userdata_before_user_create', 'zeen_lp_use_different_role' );
function zeen_lp_use_different_role( $userdata ) {
$userdata['role'] = 'digital_subscriber';
return $userdata;
}
View leaky-paywall-simplecirc-level-id.php
<?php
add_filter( 'leaky_paywall_level_id_for_simplecirc_subscriber', 'zeen_set_level_id_by_price', 20, 2 );
function zeen_set_level_id_by_price( $level_id, $subscriber ) {
if ( !isset( $subscriber->subscriptions[0]->last_order->amount_paid ) ) {
return 1;
}
View leaky-paywall-hide-category-archive.php
<?php
add_action( 'template_redirect', 'zeen101_custom_redirects' );
function zeen101_custom_redirects() {
if ( !is_category() ) {
return;
}
View leaky-paywall-custom-field-reporting-tool.php
<?php
add_filter('leaky_paywall_reporting_tool_meta', 'testmag_reporting_tool_company_field_header' );
function testmag_reporting_tool_company_field_header( $meta ) {
$meta[] = 'company';
return $meta;
}
add_filter('leaky_paywall_reporting_tool_user_meta', 'testmag_reporting_tool_company_field_value', 20, 2 );
View leaky-paywall-custom-field-subscriber-form.php
<?php
// add the custom field
add_action( 'update_leaky_paywall_subscriber_form', 'testmag_add_company_field' );
function testmag_add_company_field( $user_id ) {
$company = get_user_meta( $user_id, '_company', true );
?>
View leaky-paywall-doi-email-content.php
<?php
add_filter( 'leaky_paywall_doi_email_message', 'zeen101_doi_email_content', 10, 2 );
function zeen101_doi_email_content( $body, $user ) {
// add the full name of the user to the double opt in verification email
$full_name = $user->first_name . ' ' . $user->last_name;
$content = '<p>Hello, ' . $full_name . '!</p>';
View leaky-paywall-extra-profile-data.php
<?php
add_filter( 'leaky_paywall_profile_your_profile_end', 'zeen_lp_show_extra_profile_data' );
function zeen_lp_show_extra_profile_data( $content ) {
$comment_number = 25;
return $content . '<p>Here is some additional data. You have written ' . $comment_number . ' comments.</p>';
}