Created
October 21, 2022 15:22
-
-
Save greenhornet79/057d8728cb1774e84429680abe9abaa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
switch ($subscriber->subscriptions[0]->last_order->amount_paid) { | |
case 0.00: | |
$level_id = 1; | |
break; | |
case 16.95: | |
$level_id = 2; | |
break; | |
case 26.95: | |
$level_id = 3; | |
break; | |
case 36.95: | |
$level_id = 4; | |
break; | |
default: | |
$level_id = 5; | |
break; | |
} | |
return $level_id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment