Summary
By default, when a MemberPress Corporate Accounts subscription expires or the parent account is disabled, all associated sub-account users immediately lose access to protected content. MemberPress does not include a native fallback or downgrade setting for corporate seats. This leaves sub-account users with no active membership and no path to re-engage.
This document describes how to implement a custom code solution that automatically assigns a designated fallback membership to sub-account users when their corporate seat is deactivated. The fallback membership is typically a free or low-tier membership that allows the site owner to retain communication with the user and present a clear upgrade path to an individual subscription.
Troubleshooting
In the MemberPress Corporate Accounts ecosystem, a sub-account’s access is tied directly to the parent transaction status. When the parent account expires or is disabled by an administrator, all associated sub-accounts are deactivated. The mepr-txn-status-expired action hook fires when a transaction transitions to an expired status, and the mpca_corporate_account_disabled hook fires when an administrator disables a parent corporate account. Neither hook triggers any automatic membership reassignment by default.
Prerequisites
The following requirements must be met before implementing this solution:
- MemberPress (any plan that includes access to the Corporate Accounts add-on);
- MemberPress Corporate Accounts Add-on, installed and activated;
- A fallback membership already created at Dashboard > MemberPress > Memberships. This is typically a free or no-cost membership. See Creating Memberships for instructions;
How to Assign a Fallback Membership for Expired Corporate Sub-Accounts
Step 1: Locate the Fallback Membership ID
- Navigate to Dashboard > MemberPress > Memberships.
- Hover over the fallback membership in the list.
- Note the post ID shown in the URL at the bottom of the browser (e.g.,
post=[[FALLBACK_MEMBERSHIP_ID]]). This is the ID used in the code snippet below.
Step 2: Add the Custom Code Snippet
- Add the following code snippet to the site using a plugin like WPCode, or by adding it to the active child theme’s
functions.phpfile.
<?php
/**
* MemberPress: Corporate Fallback Membership
* Assigns a fallback membership when a corporate sub-account expires.
*/
if (!defined('ABSPATH')) {
die('You are not allowed to call this page directly.');
}
class MeprCorporateFallbackMembership {
/**
* Set this to the ID of the fallback membership.
* Find it in Dashboard > MemberPress > Memberships.
*/
const FALLBACK_MEMBERSHIP_ID = 123; // <-- CHANGE 123 TO YOUR ACTUAL ID
public function __construct() {
// Triggers when a transaction status transitions to expired
add_action('mepr-txn-status-expired', array($this, 'handle_expired_txn'), 10, 2);
// Triggers when a parent corporate account is disabled
add_action('mpca_corporate_account_disabled', array($this, 'handle_corporate_disabled'), 10, 1);
}
public function handle_expired_txn($txn) {
if (!($txn instanceof MeprTransaction) || $txn->txn_type !== MeprTransaction::$sub_account_str) {
return;
}
$this->assign_fallback($txn->user_id);
}
public function handle_corporate_disabled($corporate_account) {
if (!class_exists('MPCA_Corporate_Account')) {
return;
}
$sub_account_users = $corporate_account->sub_account_users();
if (empty($sub_account_users)) {
return;
}
foreach ($sub_account_users as $user) {
$user_id = is_object($user) ? $user->ID : $user;
$this->assign_fallback($user_id);
}
}
private function assign_fallback($user_id) {
$fallback_id = self::FALLBACK_MEMBERSHIP_ID;
$mepr_user = new MeprUser($user_id);
$active_products = $mepr_user->active_product_subscriptions('ids');
// Check if the user already has the fallback membership active
if (in_array($fallback_id, $active_products)) {
return;
}
// Create a new manual, completed transaction for the fallback membership
$txn = new MeprTransaction();
$txn->user_id = $user_id;
$txn->product_id = $fallback_id;
$txn->status = MeprTransaction::$complete_str;
$txn->gateway = MeprTransaction::$manual_gateway_str;
$txn->store();
}
}
new MeprCorporateFallbackMembership();
- On line 16 of the snippet, replace
123with the actual fallback membership ID identified in Step 1. - Save and activate the snippet.
How the Code Works
The snippet registers listeners for two separate events:
mepr-txn-status-expired— fires when any individual transaction transitions to an expired status. The handler checks whether the transaction belongs to a sub-account user (using thesub_accounttransaction type). If so, it calls the fallback assignment method for that user;mpca_corporate_account_disabled— fires when a parent corporate account is manually disabled by an administrator. The handler iterates over all sub-account users attached to that corporate account and calls the fallback assignment method for each one;
The assignment method (assign_fallback) first checks whether the user already holds an active subscription to the fallback membership. If the user is already enrolled, no duplicate transaction is created. Otherwise, a new completed manual transaction is stored in MemberPress, granting the user immediate access to the fallback membership.
Known Limitations and Considerations
- The fallback transaction created by this code is a lifetime transaction with no expiration date. If a time-limited fallback is required, the
$txn->expires_atproperty must be set before calling$txn->store(); - This solution does not affect the parent corporate account user — only sub-account users receive the fallback membership;
- If the Corporate Accounts add-on is deactivated, the
mpca_corporate_account_disabledhook will not fire. Themepr-txn-status-expiredhandler will still run but will exit early due to the sub-account transaction type check; - This code does not send any notification email to the affected users. MemberPress reminders configured for the fallback membership can be used to communicate the membership change to users automatically;
- Custom development is outside the scope of MemberPress support. The snippet is provided as a starting point. Refer users requiring modifications to a qualified WordPress developer;
Public Facing Documentation / Additional References
Public Facing Documentation
- Configuring & Troubleshooting the Corporate Accounts Add-On
- Creating Memberships in MemberPress
- Creating Groups in MemberPress (for native downgrade path configuration)
- Membership Options Overview









