MemberPress: Rearranging Navigation Items On The Account Page
add_action(‘wp_head’, function() { ?>Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_action(‘wp_head’, function() { ?>Continue reading
/** * Display featured images of the current user’s active memberships * Add the [membership_thumbnail] shortcode to display the featured images of all active memberships of the current user. */ function custom_membership_thumbnail_shortcode() { if ( !is_user_logged_in() ) return; $user =…Continue reading
add_filter( ‘mepr_custom_cancel_link’, function( $link, $sub ) { // Get the subscription start time as a timestamp $subscription_start = strtotime( $sub->created_at ); // Get the current time as a timestamp $current_time = time(); // Calculate the number of months passed since…Continue reading
function mp_membership_renewal_date() { if (!is_user_logged_in()) { return ‘You need to be logged in to view this information.’; } global $wpdb; $user_id = get_current_user_id(); // Query to get all active MemberPress transactions for the current user $transactions = $wpdb->get_results($wpdb->prepare( “SELECT txn.*,…Continue reading
function mp_membership_status() { if (!is_user_logged_in()) { return ‘You need to be logged in to view this information.’; } global $wpdb; $user_id = get_current_user_id(); // Query to get all active MemberPress transactions for the current user $transactions = $wpdb->get_results($wpdb->prepare( “SELECT txn.*,…Continue reading
function mp_custom_membership_info() { if (!is_user_logged_in()) { return ‘You need to be logged in to view this information.’; } global $wpdb; $user_id = get_current_user_id(); // Query to get all active MemberPress transactions for the current user $transactions = $wpdb->get_results($wpdb->prepare( “SELECT txn.*,…Continue reading
function mepr_account_nav_courses_link($link) { if (current_user_can(‘administrator’)) { // Set the user-role-based condition return ‘/admin-courses/’; // If the user matches the user-role-based condition, apply this URL } else { return ‘/user-courses/’; // If the user DOESN’T match the user-role-based condition, apply this…Continue reading
function mepr_account_nav_courses_link($link) { // Change the link URL from the default to the new courses URL return ‘/courses/’; } add_filter(‘mepr-account-nav-courses-link’, ‘mepr_account_nav_courses_link’);Continue reading
// CHANGE this array – should be a comma separated list of Membership ID’s to apply the signup codes to $GLOBALS[‘free_memberships_require_coupon’] = array(123); function make_coupon_mandatory_free_membership($errors) { if(!isset($_POST[‘mepr_coupon_code’]) || trim($_POST[‘mepr_coupon_code’]) == ” && in_array($_POST[‘mepr_product_id’], $GLOBALS[‘free_memberships_require_coupon’])) { $errors[] = ‘A valid coupon…Continue reading
add_action(‘mepr-event-member-signup-completed’, function($event) { $user = $event->get_data(); bp_set_member_type($user->ID, ‘member_type’); });Continue reading