Skip to content

Instantly share code, notes, and snippets.

View greenhornet79's full-sized avatar
👽
Craft

Jeremy Green greenhornet79

👽
Craft
View GitHub Profile
<?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>
<?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 '';
<?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;
}
<?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;
}
<?php
add_action( 'template_redirect', 'zeen101_custom_redirects' );
function zeen101_custom_redirects() {
if ( !is_category() ) {
return;
}
<?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 );
<?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 );
?>
<?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>';
<?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>';
}
<?php
add_filter( 'leaky_paywall_nag_message_text', 'zeen_lp_nag_by_cat', 20, 2 );
function zeen_lp_nag_by_cat( $text, $post_id ) {
$cats = get_the_category( $post_id );
foreach( $cats as $cat ) {