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
#lang racket | |
(define const? number?) | |
(define var? symbol?) | |
(define (ev σ θ e) | |
(match e | |
[(? const? e) (cons σ e)] | |
[(? var? e) (cons σ (hash-ref θ e))] | |
; Comma here matches any var |
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
[ | |
{ | |
"name": "Checker Me Up", | |
"description": "Pawns Start in a Checker Board Formation", | |
"newBoard": "RNBQKNBRP*P*P*P**P*P*P*PP*P*P*P*p*p*p*p**p*p*p*pp*p*p*p*rnbqknbr" | |
}, | |
{ | |
"name": "Horse Spies", | |
"description": "Sneaky Horsies", | |
"newBoard": "nNBQKBNnPPPPPPPP********************************ppppppppNnbqkbnN" |
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 | |
/** | |
* If a user paid by check, give them a $50 discount. | |
*/ | |
function my_pmpro_discount_with_check( $level ) { | |
if ( 'check' === $_REQUEST['gateway'] ) { | |
$level->initial_payment = $level->initial_payment - 50; | |
// $level->billing_amount = $level->billing_amount - 50; //to update recurring payments too |
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 | |
function my_gettext_membership( $output_text, $input_text, $domain ) { | |
global $pagenow; | |
if ( ! is_admin() && 'pmproarc' === $domain ) { | |
$output_text = preg_replace( '/Yes, renew at.+$/', 'Allow recurring payments using PayPal', $output_text ); | |
} | |
if ( 'profile.php' === $pagenow ) { | |
$output_text = str_replace( 'Account Management', 'Password Management', $output_text ); | |
} |
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 | |
/** | |
* Disable Redirection to Specific Page | |
*/ | |
function my_wp_redirect($location) { | |
// TODO: Change '10' to the page id that should not be redirected to | |
$page_id = 10; |
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 this function to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
function pmproama_send_invoice( $user_id ) { | |
$order = new MemberOrder(); | |
$order->getLastMemberOrder( $user_id ); | |
$pmproemail = new PMProEmail(); | |
$pmproemail->sendInvoiceEmail( get_userdata( $user_id ), $order ); |
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 | |
function my_pmpro_after_change_membership_level( $level_id, $user_id ) { | |
// TODO: Replace '1' with level id of free level | |
$free_level = 1; | |
if ( $level_id == 0 && empty( $_REQUEST['delete_account'] ) ) { | |
//cancelling, give them level 1 instead | |
pmpro_changeMembershipLevel( $free_level, $user_id ); | |
} |
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 | |
function my_pmpro_change_stripe_description( $description, $MemberOrder ) { | |
return 'This is my new description.'; | |
} | |
add_filter("pmpro_stripe_order_description", "my_pmpro_change_stripe_description", 10, 2); |
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 | |
function my_pmpro_add_personal_data_fields( $fields ) { | |
$fields['meta_name'] = 'Pretty Meta Name'; | |
// Copy the above line for each field you want to include. | |
return $fields; | |
} | |
add_filter( 'pmpro_get_personal_user_meta_fields', 'my_pmpro_add_personal_data_fields' ); | |
function my_pmpro_add_personal_data_fields_to_erase( $fields ) { |
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 | |
/* | |
Each user can only use one discount code. | |
Add this to your active theme's functions.php or a custom plugin. | |
*/ | |
function my_pmpro_check_discount_code($okay, $dbcode, $level_id, $code) | |
{ | |
global $wpdb, $current_user; | |
$codes_used = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->pmpro_discount_codes_uses WHERE user_id = '" . $current_user->ID . "'" ); |