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-validate-signup', function($errors) { | |
/* Edit this to add or remove email addresses you'd like to block from registering. | |
For example, if you'd like to block members with the following email addresses: | |
- member@email.com | |
- anothermember@google.com | |
Then the code would look something like this: $email_addresses_to_block = ['member@email.com', 'anothermember@google.com']; | |
*/ | |
$email_addresses_to_block = ['member@email.com']; |
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 maybe_hide_pause_resume_links($link, $sub) { | |
// Replace 123, 456 with the membership IDs which members can still pause/resume subscriptions for. | |
$products_to_allow = array('123', '456'); | |
$product = $sub->product(); | |
if(in_array($product->ID, $products_to_allow)) { | |
return $link; | |
} else { |
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 check_duplicate_address_fields($errors) { | |
$mepr_options = MeprOptions::fetch(); | |
$address_fields = array( | |
$_POST['mepr-address-one'], | |
$_POST['mepr-address-two'], | |
$_POST['mepr-address-city'], | |
$_POST['mepr-address-zip'], |
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_shortcode('mepr-list-unsubscribed-memberships', function() { | |
$content = ''; | |
$user = MeprUtils::get_currentuserinfo(); | |
$memberships = MeprProduct::get_all(); | |
$unsubscribed_memberships = array(); | |
if(!$user) { | |
return $content; |
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_shortcode('mpcs-unenrolled-courses', function() { | |
$unenrolled_courses = array(); | |
$current_user = MeprUtils::get_currentuserinfo(); | |
$mepr_user = new MeprUser($current_user->ID); | |
$courses = get_posts(array('post_type' => 'mpcs-course', 'post_status' => 'publish', 'posts_per_page' => '-1', 'orderby'=> 'title', 'order' => 'ASC')); | |
if(false == MeprUtils::is_logged_in_and_an_admin()) { |
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.');} | |
/* | |
Integration of User Roles into MemberPress | |
*/ | |
class MeprUserRoles { | |
public function __construct() { | |
add_action('mepr-txn-store', array($this, 'process_status_changes')); | |
add_action('mepr-txn-expired', array($this, 'process_status_changes'), 10, 2); | |
add_action('mepr_post_delete_transaction', array($this, 'process_destroy_txn'), 10, 3); |
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 | |
// Paste this into functions.php or a plugin like Code Snippets | |
function add_stripe_payment_args($args, $txn = false, $sub = false) { | |
if($txn) { | |
$user = $txn->user(); | |
$args['metadata']['mepr_fatturazione_elettronica'] = get_user_meta($user->ID, 'mepr_fatturazione_elettronica', true); | |
} | |
return $args; | |
} |
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 add_custom_role( $bbp_roles ) { | |
$bbp_roles['basic_member_role'] = array( | |
'name' => 'Basic Member', | |
'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants | |
); | |
return $bbp_roles; | |
} |
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('avada_after_content', function() { | |
global $post; | |
if(class_exists('MeprRule') && MeprRule::is_locked($post)) { | |
$unauth_message = (class_exists('MeprRulesCtrl') ? MeprRulesCtrl::unauthorized_message($post) : ''); | |
echo do_shortcode($unauth_message); | |
?> | |
<script> |
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 add_optin_status($user) { | |
if(isset($_POST['meprconvertkit_opt_in'])) { | |
update_user_meta($user->ID, 'mepr_convertkit_optin_status', true); | |
} else { | |
update_user_meta($user->ID, 'mepr_convertkit_optin_status', false); | |
} | |
} | |
add_action('mepr-signup-user-loaded', 'add_optin_status', 11); |