Skip to content

Instantly share code, notes, and snippets.

@DumahX
DumahX / mepr-pw-changed-message.php
Last active March 29, 2021 18:23
Change "Password Changed" message body
<?php
// Copy the lines below this one into a plugin like Code Snippets (run everywhere type)
function mepr_pw_changed_message( $message, $recipients, $subject, $headers ) {
if ( strpos( $subject, 'Your new Password' ) !== false ) {
$message = 'This is a modified message'; // Change 'This is a modified message'.
}
return $message;
}
add_filter( 'mepr-wp-mail-message', 'mepr_pw_changed_message', 10, 4 );
<?php
function mepr_completed_recurring_transaction( $event ) {
$transaction = $event->get_data();
if ( $transaction->subscription_id > 0 && $transaction->product_id == 76026 ) {
// Subscription id is greater than zero, so it's a recurring subscription.
// Make sure the transaction's product ID is 76026.
$sub = $transaction->subscription();
<?php
function mepr_forward_old_ipn() {
if ( ! isset( $_GET['option'] ) && $_GET['option'] != 'com_osmembership' || empty( $_POST ) ) {
return;
}
$memberpress_ipn_url = 'https://www.site.com/mepr/notify/pja675-3wu/ipn'; // CHANGE THIS
wp_remote_post( $memberpress_ipn_url, array( 'body' => stripslashes_deep( $_POST ), 'sslverify' => false ) );
<?php
// Copy the lines below this one into a plugin like Code Snippets (run everywhere type)
function mepr_change_lc_paypal( $args ) {
$args['lc'] = 'fr_CA';
return $args;
}
add_filter( 'mepr_paypal_std_payment_vars', 'mepr_change_lc_paypal', 10, 1 );
<?php
function mepr_hide_post_code_stripe_elements( $hide ) {
return true;
}
add_filter( 'mepr-stripe-form-hide-postal-code', 'mepr_hide_post_code_stripe_elements' );
<?php
function mepr_subscription_num_days() {
$user_id = get_current_user_id();
if ( 0 == $user_id ) {
return;
}
$user = new MeprUser( $user_id );
<?php
function mepr_restrict_coupons_by_memberships( $errors ) {
$coupon = isset( $_POST['mepr_coupon_code'] ) && ! empty( $_POST['mepr_coupon_code'] ) ? $_POST['mepr_coupon_code'] : '';
$user_id = get_current_user_id();
if ( $coupon == 'COUPON' && $user_id == 0 ) {
// User doesn't have an account yet, so turn down their coupon attempt.
$errors['mepr_coupon_denied'] = 'You cannot use this coupon.';
}
<?php
$debug_file = fopen( 'debug.txt', 'a' );
$text = 'The data was sent.';
fwrite( $debug_file, $text );
fclose( $debug_file );
<?php
function mepr_change_stripe_checkout_desc( $desc, $payment ) {
if ( isset( $payment->settings->stripe_checkout_enabled ) && $payment->settings->stripe_checkout_enabled == 'on' ) {
$desc = "Pay with Apple Pay"; // Edit this.
}
return $desc;
}
add_filter( 'mepr_signup_form_payment_description', 'mepr_change_stripe_checkout_desc', 10, 2 );
<?php
function mepr_remove_unauthorized_meta_box() {
if ( ! current_user_can( 'administrator' ) ) {
foreach ( get_post_types() as $post_type ) {
remove_meta_box( 'mepr_unauthorized_message', $post_type, 'advanced' );
}
}
}
add_action( 'admin_head', 'mepr_remove_unauthorized_meta_box' );