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_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 ) {
<?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 ) {
<?php
add_filter( 'leaky_paywall_basic_shipping_countries', 'zeen_us_and_canada_only' );
function zeen_us_and_canada_only( $countries ) {
$new_countries = array(
'US' => 'United States',
'CA' => 'Canada'
);