Skip to content

Instantly share code, notes, and snippets.

Avatar
👽
Craft

Jeremy Green greenhornet79

👽
Craft
View GitHub Profile
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>';
}
View leaky-paywall-nag-by-category.php
<?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 ) {
View leaky-paywall-renewal-email.php
<?php
/* two actions
leaky_paywall_stripe_invoice_payment_succeeded
leaky_paywall_stripe_payment_intent_succeeded
*/
add_action( 'leaky_paywall_stripe_invoice_payment_succeeded', 'zeen_send_renewal_email_notification', 10, 2 );
function zeen_send_renewal_email_notification( $user, $stripe_object ) {