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 | |
// Copy the lines below this one into a plugin like Code Snippets (run everywhere type) | |
/** | |
* Remove an object filter. | |
* | |
* @param string $tag Hook name. | |
* @param string $class Class name. Use 'Closure' for anonymous functions. | |
* @param string|void $method Method name. Leave empty for anonymous functions. |
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 mepr_limit_phone_digits( $errors ) { | |
$phone = isset( $_POST['mepr_phone'] ) ? trim( $_POST['mepr_phone'] ) : ''; | |
if ( empty( $phone ) ) { | |
$errors['empty_phone'] = 'Phone number cannot be empty.'; | |
} | |
// Remove all non-numeric characters from the phone number. |
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 user_corp_status() { | |
$current_wpuser = wp_get_current_user(); | |
$parent_ca_id = get_user_meta( $current_wpuser->ID, 'mpca_corporate_account_id', true ); | |
if ( (int) $parent_ca_id > 0 ) { | |
// Sub-account. Do sub-account stuff here. | |
} else { | |
// Parent account. Do parent account stuff here. |
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 mepr_disable_set_password_emails( $recipients, $subject, $message, $headers ) { | |
if ( strpos( strtolower( $subject ), 'set your new password' ) !== false ) { | |
$recipients = array(); | |
} | |
return $recipients; | |
} | |
add_filter( 'mepr-wp-mail-recipients', 'mepr_disable_set_password_emails', 11, 4 ); |
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 mepr_get_membership_titles() { | |
$user = MeprUtils::get_currentuserinfo(); | |
if ( ! $user ) { | |
return; | |
} | |
$memberships = explode( ",", $user->get_active_subscription_titles() ); |
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 mepr_change_set_password( $recipients, $subject, $message, $headers ) { | |
if ( strpos( strtolower( $subject ), 'set your new password' ) !== false ) { | |
if ( ! is_user_logged_in() ) { | |
return; | |
} | |
$user = new MeprUser( get_current_user_id() ); | |
$locals = array( |
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 allow_sub_account_password( $ignored, $row, $args ) { | |
if ( is_array( $ignored ) ) { | |
foreach ( $ignored as $key => $value ) { | |
if ( $value == 'password' ) { | |
unset( $ignored[ $key ] ); | |
} | |
} | |
} |
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(!defined('ABSPATH')) {die('You are not allowed to call this page directly.');} ?> | |
<?php $parent_ca_id = get_user_meta( $mepr_current_user->ID, 'mpca_corporate_account_id', true ); ?> | |
<div class="mp_wrapper"> | |
<?php if(!empty($welcome_message)): ?> | |
<div id="mepr-account-welcome-message"> | |
<?php echo MeprHooks::apply_filters('mepr-account-welcome-message', do_shortcode($welcome_message), $mepr_current_user); ?> | |
</div> | |
<?php endif; ?> |
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( 'mepr-phone-input-config', 'cp_filter_default_phone_input_country' ); | |
/** | |
* Filters the default country for the telephone input field. | |
* | |
* @param array $args Default config args | |
* | |
* @return array | |
*/ |
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_action('wp_head', function() { ?> | |
<script> | |
(function($) { | |
$(document).ready(function() { | |
var f = $('.mepr-signup-form'); | |
if(f) { | |
f.each(function(i, el) { | |
var c = $(el).find('select[name=mepr-address-country]'); |