Action Hooks in MemberPress
Here you can find the list of the most common action hooks divided into sections that you can find and use in MemberPress.
If you want to learn more about hooks please check out Actions and Filters in MemberPress article.
Checkout Form
- mepr-above-checkout-form
- mepr-checkout-before-name
- mepr-checkout-after-email-field
- mepr-checkout-after-password-fields
- mepr-checkout-before-coupon-field
- mepr-checkout-before-submit
- mepr-stripe-payment-form-before-name-field
- mepr-stripe-payment-form-card-field
- mepr-stripe-payment-form
- mepr-checkout-before-custom-fields
- mepr-checkout-after-custom-fields
Subscriptions & Transactions
- mepr-signup
- mepr-save-account
- mepr-event-create
- mepr-event-login
- mepr-event-member-signup-completed
- mepr-event-transaction-completed
- mepr-event-recurring-transaction-completed
- mepr-event-renewal-transaction-completed
- mepr-event-recurring-transaction-failed
- mepr-event-non-recurring-transaction-completed
- mepr-event-non-recurring-transaction-expired
- mepr-event-recurring-transaction-expired
- mepr-event-transaction-refunded
- mepr-event-transaction-expired
- mepr-event-subscription-created
- mepr-event-subscription-paused
- mepr-event-subscription-resumed
- mepr-event-subscription-stopped
- mepr-event-subscription-expired
- mepr-event-member-added
- mepr_subscription_transition_status
- mepr-txn-transition-status
- mepr-txn-status-complete
- mepr-txn-store
- mepr-transaction-expired
- mepr-admin-subscriptions-cell
- mepr-admin-transactions-cell
- mepr_pre_delete_transaction
- mepr_post_delete_transaction
Account Page
- mepr-account-home-before-name
- mepr-account-home-fields
- mepr_account_home
- mepr_account_nav
- mepr_account_nav_content
- mepr-account-after-password-fields
- mepr_account_password
- mepr_account_payments_table_header
- mepr_account_payments_table_row
- mepr_account_payments
- mepr_before_account_subscriptions
- mepr-account-subscriptions-th
- mepr_account_subscriptions_sub_account_auto_rebill
- mepr_account_subscriptions_sub_account_terms
- mepr-account-subscriptions-actions
- mepr-account-subscriptions-td
- mepr-account-subscriptions-table
- mepr_account_subscriptions
Login Page
Options Page
- mepr_display_pages_options
- mepr_display_account_options
- mepr_display_emails_options
- mepr_display_marketing_options
Memberships Page
- mepr-membership-meta-boxes
- mepr-membership-save-meta
- mepr_members_list_table_row
- mepr_products_permissions_tab
Coupons Page
Miscellaneous
- mepr-admin-subscriptions-cell
- mepr-account-is-active
- mepr-account-is-inactive
- mepr_menu
- mepr_enqueue_scripts
- mepr_payment_failure
Courses
- mpcs_classroom_preview_menu
- mpcs_classroom_user_menu
- mpcs_classroom_start_header
- mpcs_classroom_end_header
- mpcs_classroom_start_sidebar
- mpcs_classroom_end_sidebar
- mpcs_courses_footer
- mpcs_classroom_start_instructor
- mpcs_classroom_end_instructor
- mpc_started_course
- mpc_completed_course
- mpc_started_section
- mpc_completed_section
- mpc_completed_lesson
- mpc_admin_general_options
Corporate Accounts
mepr-above-checkout-form
Description
Parameters
$membership_id Number
Example
function mepr_content_above_registration_form($membership_id) { // Put your content here }<br>add_action('mepr-above-checkout-form', 'mepr_content_above_registration_form');
add_action('mepr-above-checkout-form', 'mepr_content_above_registration_form');
mepr-checkout-before-name
Description
Parameters
$membership_id Number
Example
function mepr_content_above_name($membership_id) { // Put your content here }<br>add_action('mepr-checkout-before-name', 'mepr_content_above_name');
add_action('mepr-checkout-before-name', 'mepr_content_above_name');
mepr-checkout-after-email-field
Description
Add Email Validation Field to MemberPress checkout form
Parameters
$membership_id Number
Example
<?php function display_validate_email_field($membership_id) { ?> <div class="mp-form-row mepr_validate_email"> <div class="mp-form-label"> <label><?php _ex('Verify Email:*', 'ui', 'memberpress'); ?</label> <span class="cc-error"><?php _ex('Invalid Email', 'ui', 'memberpress'); ?></span> </div> <input type="email" name="user_validate_email" id="user_validate_email" class="mepr-form-input" value="" required /> </div> <?php } add_action('mepr-checkout-after-email-field', 'display_validate_email_field');
mepr-checkout-after-password-fields
Description
Parameters
$membership_id Number
Example
add_action('mepr-checkout-after-password-fields', 'mepr_content_after_password'); function mepr_content_after_password($membership_id) { // Put your content here }
mepr-checkout-before-coupon-field
Description
Parameters
$membership_id Number
Example
Add website field before coupon field (it requires more code for saving)
function mepr_add_website_field($membership_id) { ?> <div class="mp-form-row mepr_website_field"> <div class="mp-form-label"> <label>Website:*</label> </div> <input type="text" name="mepr_website_field" id="mepr_website_field" class="mepr-form-input" value="<?php echo (isset($_POST['mepr_website_field']))?stripslashes($_POST['mepr_website_field']):''; ?>" /> </div> <?php } add_action('mepr-before-coupon-field', 'mepr_add_website_field');
mepr-checkout-before-submit
Description
Parameters
$membership_id Number
Example
Integrates MemberPress with https://wordpress.org/plugins/invisible-recaptcha/
function add_invisible_recaptcha_mepr_signup($membership_ID) { ?> <div class="mp-form-row mepr_invisible_recaptcha"> <?php do_action('google_invre_render_widget_action'); ?> </div> <?php } add_action('mepr-checkout-before-submit', 'add_invisible_recaptcha_mepr_signup');
mepr-stripe-payment-form-before-name-field
Description
Parameters
$txn Transaction Object
Example
function mepr_stripe_payment_form_before_name_field($txn) { // Put your content here } add_action('mepr-stripe-payment-form-before-name-field', 'mepr_stripe_payment_form_before_name_field');
mepr-stripe-payment-form-card-field
Description
Parameters
$txn Transaction Object
Example
function mepr_stripe_payment_form_card_field($txn) { // Put your content here } add_action('mepr-stripe-payment-form-card-field', 'mepr_stripe_payment_form_card_field');
mepr-stripe-payment-form
Description
Parameters
$txn Transaction Object
Example
function mepr_stripe_payment_form($txn) { // Put your content here } add_action('mepr-stripe-payment-form', 'mepr_stripe_payment_form');
mepr-checkout-before-custom-fields
Description
Parameters
$membership_id Number
Example
function mepr_checkout_before_custom_fields($membership_id) { // Put your content here } add_action('mepr-checkout-before-custom-fields', 'mepr_checkout_before_custom_fields');
mepr-checkout-after-custom-fields
Description
Parameters
$membership_id Number
Example
function mepr_checkout_after_custom_fields($txn) { // Put your content here } add_action('mepr-checkout-after-custom-fields', 'mepr_checkout_after_custom_fields');
mepr-signup
Description
It is used for processing the signup form before the logic progresses on to 'the_content'
Parameters
$txn Transaction Object
Example
Activates UPME profiles when a user signs up via MemberPress
function mepr_upme_activate($txn) { update_user_meta($txn->user_id, 'upme_activation_status', 'ACTIVE'); update_user_meta($txn->user_id, 'upme_approval_status', 'ACTIVE'); update_user_meta($txn->user_id, 'upme_user_profile_status', 'ACTIVE'); upme_update_user_cache($txn->user_id); } add_action('mepr-signup', 'mepr_upme_activate'); //Use this if you don't want to wait for completed payment
mepr-save-account
Description
It is used on saving of the main Account page on front-end
Parameters
$user User Object
Example
Save new display name on Account page
function mpdn_save_account($user) { $display_name = stripslashes($_POST['mepr_user_display_name']); $user->display_name = $display_name; $user->store(); //Set the nickname to the display name also, why not? update_user_meta($user->ID, 'nickname', $display_name); } add_action('mepr-save-account', 'mpdn_save_account');
mepr-event-create
Description
It is used every time the new event is created and stored in the wp_mepr_events table
Parameters
$event Event Object
Example
Do something when a user becomes active on a membership, and when they become inactive on a membership
function listen_to_mepr_events($event) { $obj = $event->get_data(); //$obj might be a MeprTransaction object or a MeprSubscription object if(!($obj instanceof MeprTransaction) && !($obj instanceof MeprSubscription)) { return; // nothing here to do if we're not dealing with a txn or sub } $member = $obj->user(); if($member->is_active_on_membership($obj)) { //member is active on membership } else { //member is no longer active on this membership } } add_action('mepr-event-create', 'listen_to_mepr_events');
mepr-event-login
Description
It is used for the first login on website during new signup
Parameters
$event Event Object
Example
Remove State Field from MemberPress Signup Forms
//Remove the State Field completely function trim_down_address_fields($options) { foreach($options->address_fields as $i => $o) { if($o->field_key == 'mepr-address-state') { unset($options->address_fields[$i]); } } return $options; } add_filter('mepr_fetch_options', 'trim_down_address_fields'); //Add a fake state value to each user function populate_state_field($event) { $user = $event->get_data(); update_user_meta($user->ID, 'mepr-address-state', 'fake'); } add_action('mepr-event-login', 'populate_state_field'); //For Single Page Checkout, add Fake State function mepr_cust_fake_state($tax_rate, $country, $state, $postcode, $city, $street, $usr = null, $prd_id = null) { $_POST['mepr_address_state'] = 'fake'; return $tax_rate; } add_filter('mepr_find_tax_rate', 'mepr_cust_fake_state', 19, 8);
mepr-event-member-signup-completed
Description
Capture a new member signup. Only ever triggers once for each new member. Does not trigger for exising members who have subscribed to a Membership before. The user may not be logged in when this is called as it is triggered when a user is added over the REST API, and also when a user is added from the dashboard (MemberPress -> Members -> Add New)
Parameters
$event Event Object
Example
function mepr_capture_new_member_signup_completed($event) { $user = $event->get_data(); $txn_data = json_decode($event->args); //Do what you need } add_action('mepr-event-member-signup-completed', 'mepr_capture_new_member_signup_completed');
mepr-event-transaction-completed
Description
Example
Capture any completed transaction (recurring and non-recurring) event
Parameters
$event Event Object
function catch_first_payment_after_trial($event) { $transaction = $event->get_data(); $subscription = $transaction->subscription(); $is_first_real_payment = false; if($subscription !== false) { if($subscription->trial && $subscription->trial_amount <= 0.00 && $subscription->txn_count == 1) { $is_first_real_payment = true; } elseif($subscription->trial && $subscription->trial_amount > 0.00 && $subscription->txn_count == 2) { $is_first_real_payment = true; } } if($is_first_real_payment) { // This is the first real payment after a paid or free trial period // So do what you will in here } } add_action('mepr-event-transaction-completed', 'catch_first_payment_after_trial');
mepr-event-recurring-transaction-completed
Description
Capture every transaction completed event for recurring
Parameters
$event Event Object
Example
Catch the first completed transaction for recurring memberships
function catch_first_recurring_payments($event) { $transaction = $event->get_data(); $sub = $txn->subscription(); if($sub->txn_count > 1) { return; } // Get some data $product_id = $txn->product_id; $user_id = $txn->user_id; $user = get_user_by('id', $user_id); $user_email = $user->user_email; $user_name = $user->display_name; } add_action('mepr-event-recurring-transaction-completed', 'catch_first_recurring_payments');
mepr-event-renewal-transaction-completed
Description
Capture all completed renewal transactions event for recurring memberships. It does not capture the first payment for recurring membership.
Parameters
$event Event Object
Example
function catch_renewal_payments($event) { $transaction = $event->get_data(); // Do what you need } add_action('mepr-event-renewal-transaction-completed', 'catch_renewal_payments');
mepr-event-recurring-transaction-failed
Description
Capture a failed Transaction event
Parameters
$event Event Object
Example
function mepr_capture_failed_transaction($event) { $transaction = $event->get_data(); $subscription = $transaction->subscription(); $user = $transaction->user(); // Do what you need } add_action('mepr-event-recurring-transaction-failed', 'mepr_capture_failed_transaction');
mepr-event-non-recurring-transaction-completed
Description
Capture a new One-Time Subscription created event
Parameters
$event Event Object
Example
function mepr_capture_new_one_time_sub($event) { $transaction = $event->get_data(); $user = $transaction->user(); //Do what you need } add_action('mepr-event-non-recurring-transaction-completed', 'mepr_capture_new_one_time_sub');
mepr-event-non-recurring-transaction-expired
Description
Example
Capture expired non-recurring transaction event
Parameters
$event Event Object
function catch_non_recurring_txn_expired($event) { $transaction = $event->get_data(); $user = $transaction->user(); // Do what you need } add_action('mepr-event-non-recurring-transaction-expired', 'catch_non_recurring_txn_expired');
mepr-event-recurring-transaction-expired
Description
Example
Capture expired recurring transaction event
Parameters
$event Event Object
function catch_recurring_txn_expired($event) { $transaction = $event->get_data(); $user = $transaction->user(); // Do what you need } add_action('mepr-event-recurring-transaction-expired', 'catch_recurring_txn_expired');
mepr-event-transaction-refunded
Description
Capture a refunded Transaction event
Parameters
$event Event Object
Example
function mepr_capture_refunded_transaction($event) { $transaction = $event->get_data(); $subscription = $transaction->subscription(); //This may return false if it's a one-time transaction that was refunded $user = $transaction->user(); //Do what you need } add_action('mepr-event-transaction-refunded', 'mepr_capture_refunded_transaction');
mepr-event-transaction-expired
Description
Capture a Transaction expired event
Parameters
$event Event Object
Example
function mepr_capture_expired_transaction($event) { //BE CAREFUL WITH THIS ONE //This could be a prior recurring transaction that has expired //So the user might still be active on the subscription with a new transaction //So you might check // - if the $subscription exists // - if so, then is $subscription->status = 'active' still // - if so, then it's possible the user is not really expired on it // - to check this use the $user->is_already_subscribed_to($transaction->product_id) method // Note: the is_already_subscribed_to method only checks active subscriptions. $transaction = $event->get_data(); $subscription = $transaction->subscription(); //This may return false if it's a one-time transaction that has expired $user = $transaction->user(); //Do what you need } add_action('mepr-event-transaction-expired', 'mepr_capture_expired_transaction');
mepr-event-subscription-created
Description
Capture a new Recurring Subscription created event
Parameters
$event Event Object
Example
function mepr_capture_new_recurring_sub($event) { $subscription = $event->get_data(); $user = $subscription->user(); //Do what you need } add_action('mepr-event-subscription-created', 'mepr_capture_new_recurring_sub');
mepr-event-subscription-paused
Description
Capture a Recurring Subscription paused event
Parameters
$event Event Object
Example
function mepr_capture_paused_sub($event) { $subscription = $event->get_data(); $user = $subscription->user(); //Do what you need } add_action('mepr-event-subscription-paused', 'mepr_capture_paused_sub');
mepr-event-subscription-resumed
Description
Capture a Recurring Subscription resumed event
Parameters
$event Event Object
Example
function mepr_capture_resumed_sub($event) { $subscription = $event->get_data(); $user = $subscription->user(); //Do what you need } add_action('mepr-event-subscription-resumed', 'mepr_capture_resumed_sub');
mepr-event-subscription-stopped
Description
Capture a Recurring Subscription cancelled event (and detect who did it)
Parameters
$event Event Object
Example
function mepr_capture_stopped_sub($event) { $subscription = $event->get_data(); $user = $subscription->user(); if(is_user_logged_in()) { if(current_user_can('manage_options')) { //An admin cancelled this from the dashboard } else { //User cancelled from their account page or upgraded to a new plan } } else { //Cancelled from a gateway Webhook or IPN notification //Not really a way to tell why but it could have been an // - admin cancelling it at the gateway instead of in the dashboard // - or the gateway could have cancelled it because of too many failed payments // - or the gateway could have cancelled it because the max billing cycles was reached // - or in the case of PayPal a user might have cancelled their recurring profile from in their PayPal account } } add_action('mepr-event-subscription-stopped', 'mepr_capture_stopped_sub');
mepr-event-subscription-expired
Description
Capture when a subscription expires
Parameters
$sub Subscription Object
$txn Transaction Object
Example
function mepr_capture_sub_expired($sub, $txn) { //Do what you need } add_action('mepr-event-subscription-expired', 'mepr_capture_sub_expired', 10, 2);
mepr-event-member-added
Description
Capture a signup (user completed step 1, but hasn't necessarily paid yet)
Parameters
$event Event Object
Example
function mepr_capture_new_member_added($event) { $user = $event->get_data(); //Do what you need } add_action('mepr-event-member-added', 'mepr_capture_new_member_added');
mepr_subscription_transition_status
Description
Capture when the status of subscription is changed during signup or updating subscription
Parameters
$old_status String
$new_status String
$sub Subscription Object
Example
function mepr_subscription_transition_status_fn($old_status, $new_status, $sub) { // Do what you need } add_action('mepr_subscription_transition_status', 'mepr_subscription_transition_status_fn', 10, 3);
mepr-txn-transition-status
Description
Capture after transaction is done processing
Parameters
$old_status String
$new_status String
$txn Transaction Object
Example
function mepr_txn_transition_status_fn($old_status, $new_status, $txv) { // Do what you need } add_action('mepr-txn-transition-status', 'mepr_txn_transition_status_fn', 10, 3);
mepr-txn-status-complete
Description
Called after completed payment
Parameters
$event Transaction Object
Example
Activate UPME profile when a user signs up via MemberPress
function mepr_upme_activate($txn) { update_user_meta($txn->user_id, 'upme_activation_status', 'ACTIVE'); update_user_meta($txn->user_id, 'upme_approval_status', 'ACTIVE'); update_user_meta($txn->user_id, 'upme_user_profile_status', 'ACTIVE'); upme_update_user_cache($txn->user_id); } add_action('mepr-txn-status-complete', 'mepr_upme_activate');
mepr-txn-store
Description
Called after transaction is done processing including the subscr txn_count
Parameters
$txn Transaction Object
$old_txn Transaction Object
Example
function mepr_txn_store_fn($txn, $old_txn) { // Do what you need } add_action('mepr-txn-store', 'mepr_txn_store_fn', 10, 2);
mepr-transaction-expired
Description
Called when transaction expires
Parameters
$txn Transaction Object
$status Boolean
Example
Show or hide UserPro profile based on subscription status
function mepr_sync_user_pro_visibility($txn, $status = false) { global $userpro; if(class_exists('MeprUser')) { $user = new MeprUser($txn->user_id); //Make sure it's a valid user still if(!isset($user->ID) || !$user->ID) { return; } $subs = $user->active_product_subscriptions(); if(!empty($subs)) { $userpro->unblock_account($user->ID); } else { $userpro->block_account($user->ID); } } } add_action('mepr-txn-expired', 'mepr_sync_user_pro_visibility', 10, 2);
mepr-admin-subscriptions-cell
Description
It is used to add column to Subscriptions page on admin side
Parameters
$column_name String
$rec Transaction Object
$table Subscription Table Object
$attributes String
Example
(it requires more code to function properly)
function mepr_add_admin_subscriptions_cell($column_name, $rec, $table, $attributes) { $user = new MeprUser($rec->user_id); if(strpos($column_name, '_site') !== false && (int)$user->ID > 0) { $website = 'None'; $website_fields = get_user_meta($user->ID, 'mepr_custom_website_fields', true); if($website_fields) { foreach($website_fields as $f) { if(!$table->lifetime && $rec->ID == $f['sub_id']) { $website = $f['website']; break; } elseif($table->lifetime && $rec->ID == $f['txn_id']) { $website = $f['website']; break; } } } ?> <td <?php echo $attributes; ?>><?php echo $website; ?></td> <?php } } add_action('mepr-admin-subscriptions-cell', 'mepr_add_admin_subscriptions_cell', 10, 4);
mepr-admin-transactions-cell
Description
It is used to add column to Transactions page on admin side
Parameters
$column_name String
$rec Transaction Object
$attributes String
Example
function mepr_add_admin_transactions_cell($column_name, $rec, $attributes) { // Do what you need } add_action('mepr-admin-transactions-cell', 'mepr_add_admin_transactions_cell', 10, 3);
mepr_pre_delete_transaction
Description
Do action before removing transaction from the database
Parameters
$txn Transaction Object
Example
function mepr_pre_delete_transaction_fn($txn) { // Do action here } add_action('mepr_pre_delete_transaction', 'mepr_pre_delete_transaction_fn');
mepr_post_delete_transaction
Description
Do action after removing transaction from the database
Parameters
$id Number
$user User Object
$result Boolean
Example
function mepr_post_delete_transaction_fn($id, $user, $result) { // Do action here } add_action('mepr_post_delete_transaction', 'mepr_post_delete_transaction_fn', 3, 10);
mepr-account-home-before-name
Description
Add content to the Home tab of the Account page before First Name field
Parameters
$user User Object
Example
function mepr_account_home_before_name($user) { // Do what you need } add_action('mepr-account-home-before-name', 'mepr_account_home_before_name');
mepr-account-home-fields
Description
Add content to the Home tab of the Account page before Save Profile button
Parameters
$user User Object
Example
(it requires more code to function properly)
function mpdn_show_on_account($user) { ?> <div class="mp-form-row"> <div class="mp-form-label"> <label>Display Name Publically As:*<br/><small>Must be different than your username and email address</small></label> </div> <input type="text" name="mepr_user_display_name" id="mepr_user_display_name" class="mepr-form-input mepr-display-name" value="<?php echo $user->display_name; ?>" /> </div> <?php } add_action('mepr-account-home-fields', 'mpdn_show_on_account');
mepr_account_home
Description
Add content at the end of the Home tab of the Account page
Parameters
$user User Object
Example
function mepr_account_home($user) { // Do what you need } add_action('mepr_account_home', 'mepr_account_home');
mepr_account_nav
Description
It is used to add navigation item to the navigation of Account page
Parameters
$action String
Example
function mepr_add_some_tabs($action) { $support_active = (isset($_GET['action']) && $_GET['action'] == 'premium-support')?'mepr-active-nav-tab':''; ?> <span class="mepr-nav-item premium-support <?php echo $support_active; ?>"> <a href="/account/?action=premium-support">Premium Support</a> </span> <?php } add_action('mepr_account_nav', 'mepr_add_some_tabs');
mepr_account_nav_content
Description
It is used to add the content to the new tab on the Account page
Parameters
$action String
Example
function mepr_add_tabs_content($action) { if($action == 'premium-support'): //Update this 'premium-support' to match what you put above (?action=premium-support) ?> <div id="custom-support-form"> <form action="" method="post"> <label for="subject">Enter Subject:</label><br/> <input type="text" name="subject" id="subject" /> <br/><br/> <label for="content">Enter Content:</label><br/> <input type="text" name="content" id="content" /> <br/><br/> <input type="submit" name="premium-support-submit" value="Submit" /> </form> </div> <?php endif; } add_action('mepr_account_nav_content', 'mepr_add_tabs_content');
mepr-account-after-password-fields
Description
Add content to the Change password form of the Account page before Submit button
Parameters
$user User Object
Example
function mepr_account_after_password_fields($user) { // Add HTML code here } add_action('mepr-account-after-password-fields', 'mepr_account_after_password_fields');
mepr_account_password
Description
Add content at the end of the Change password form on the Account page
Parameters
$user User Object
Example
function mepr_account_password($user) { // Add HTML code here } add_action('mepr_account_password', 'mepr_account_password');
mepr_account_payments_table_header
Description
Add column at the end of the Payments tab of the Account page
Example
function mepr_account_payments_table_header() { ?> <th><?php _ex('Custom Info', 'ui', 'memberpress'); ?></th> <?php } add_action('mepr_account_payments_table_header', 'mepr_account_payments_table_header');
mepr_account_payments_table_row
Description
Add additional field at the end of the Payments tab of the Account page
Parameters
$txn Transaction Object
Example
function mepr_account_payments_table_row($txn) { // Do what you need } add_action('mepr_account_payments_table_row', 'mepr_account_payments_table_row');
mepr_account_payments
Description
Add content at the end of the Payments tab of the Account page
Parameters
$user User Object
Example
function mepr_account_payments($user) { // Do what you need } add_action('mepr_account_payments', 'mepr_account_payments');
mepr_before_account_subscriptions
Description
Add content at the beginning of the Subscriptions tab on the Account page
Parameters
$user User Object
Example
function mepr_before_account_subscriptions($user) { // Add HTML code here } add_action('mepr_before_account_subscriptions', 'mepr_before_account_subscriptions');
mepr-account-subscriptions-th
Description
It is used to display label in a new column in Subscriptions tab of the Account page
Example
(it requires more code to function properly)
function mepr_add_subscriptions_th($user, $subs) { ?> <th>Site</th> <?php } add_action('mepr-account-subscriptions-th', 'mepr_add_subscriptions_th', 10, 2);
mepr_account_subscriptions_sub_account_auto_rebill
Description
Add content to the Sub Account in the Subscription field of the Subscriptions tab on the Account page
Parameters
$txn Transaction Object
Example
function mepr_account_subscriptions_sub_account_auto_rebill_fn($txn) { // Add HTML code here } add_action('mepr_account_subscriptions_sub_account_auto_rebill', 'mepr_account_subscriptions_sub_account_auto_rebill_fn');
mepr_account_subscriptions_sub_account_terms
Description
Add content below the Subscription field of the Subscriptions tab on the Account page
Parameters
$txn Transaction Object
Example
function mepr_account_subscriptions_sub_account_terms_fn($txn) { // Add HTML code here } add_action('mepr_account_subscriptions_sub_account_terms', 'mepr_account_subscriptions_sub_account_terms_fn');
mepr-account-subscriptions-actions
Description
Add content below actions columns in the Subscriptions tab on the Account page
Parameters
$user User Object
$sub Subscription Object
$txn Transaction Object
$is_sub Boolean
Example
function mepr_account_subscriptions_actions($user, $sub, $txn, $is_sub) { // Add HTML code here } add_action('mepr-account-subscriptions-actions', 'mepr_account_subscriptions_actions', 10, 4);
mepr-account-subscriptions-td
Description
It is used to populate field in a new column in Subscriptions tab of the Account page
Example
(it requires more code to function properly)
function mepr_add_subscriptions_td($user, $sub, $txn, $is_recurring) { $website = 'None'; $website_fields = get_user_meta($user->ID, 'mepr_custom_website_fields', true); if($website_fields) { foreach($website_fields as $f) { if($is_recurring && $sub->ID == $f['sub_id']) { $website = $f['website']; break; } elseif(!$is_recurring && $txn->id == $f['txn_id']) { $website = $f['website']; break; } } } ?> <td data-label="Website"> <div class="mepr-account-website"><?php echo $website; ?></div> </td> <?php } add_action('mepr-account-subscriptions-td', 'mepr_add_subscriptions_td', 10, 4);
mepr-account-subscriptions-table
Description
Add row at the end of the Subscriptions table on the Account page
Parameters
$user User Object
$subscription Subscription Object
Example
function mepr_account_subscriptions_table($user, $subscription) { // Add HTML code here } add_action('mepr-account-subscriptions-table', 'mepr_account_subscriptions_table', 10, 2);
mepr_account_subscriptions
Description
Add content at the end of the Subscriptions tab on the Account page
Parameters
$user User Object
Example
function mepr_account_subscriptions($user) { // Add HTML code here } add_action('mepr_account_subscriptions', 'mepr_account_subscriptions');
mepr-login-form-before-submit
Description
Add content before Remember Me checkbox on the Login page
Example
function mepr_login_form_before_submit() { // Add HTML code here } add_action('mepr-login-form-before-submit', 'mepr_login_form_before_submit');
mepr-forgot-password-form
Description
Add content before Submit button on the Forgot Login Password page
Example
function mepr_forgot_password_form() { // Add HTML code here } add_action('mepr-forgot-password-form', 'mepr_forgot_password_form');
mepr-reset-password-after-password-fields
Description
Add content after Password field on the Reset Login Password page
Example
function mepr_reset_password_after_password_fields() { // Add HTML code here } add_action('mepr-reset-password-after-password-fields', 'mepr_reset_password_after_password_fields');
mepr_display_pages_options
Description
Add content to the end of the Pages tab in MemberPress settings
Example
function mepr_display_pages_options_fn() { // Do what you need } add_action('mepr_display_pages_options', 'mepr_display_pages_options_fn');
mepr_display_account_options
Description
Add content to the end of the Account tab in MemberPress settings
Example
function mepr_display_account_options_fn() { // Do what you need } add_action('mepr_display_account_options', 'mepr_display_account_options_fn');
mepr_display_emails_options
Description
Add content to the end of the Emails tab in MemberPress settings
Example
function mepr_display_emails_options_fn() { // Do what you need } add_action('mepr_display_emails_options', 'mepr_display_emails_options_fn');
mepr_display_marketing_options
Description
Add content to the end of the Marketing tab in MemberPress settings
Example
function mepr_display_marketing_options_fn() { // Do what you need } add_action('mepr_display_marketing_options', 'mepr_display_marketing_options_fn');
mepr-membership-meta-boxes
Description
Add meta box to the Membership
Parameters
$membership Membership Object
Example
function mepr_membership_meta_boxes_fn($membership) { // Do what you need } add_action('mepr-membership-meta-boxes', 'mepr_membership_meta_boxes_fn');
mepr-membership-save-meta
Description
Do what you need once membership is saving
Parameters
$txn Membership Object
Example
function mepr_membership_save_meta_fn($membership) { // Do what you need } add_action('mepr-membership-save-meta', 'mepr_membership_save_meta_fn');
mepr_members_list_table_row
Description
Display custom column in Members table
Parameters
$attributes String
$rec Object
$column_name String
$column_display_name String
Example
function mepr_members_list_table_row_fn($attributes, $rec, $column_name, $column_display_name) { // Display content } add_action('mepr_members_list_table_row', 'mepr_members_list_table_row_fn', 10, 4);
mepr_products_permissions_tab
Description
Add content to the end of the membership's Permissions tab
Parameters
$product Membership Object
Example
function mepr_products_permissions_tab_fn($product) { // Do what you need } add_action('mepr_products_permissions_tab', 'mepr_products_permissions_tab_fn');
mepr-coupon-meta-boxes
Description
Add meta box to the Coupon edit page
Parameters
$coupon Coupon Object
Example
function mepr_coupon_meta_boxes_fn($coupon) { // Do what you need } add_action('mepr-coupon-meta-boxes', 'mepr_coupon_meta_boxes_fn');
mepr-coupon-save-meta
Description
Do what you need once coupon is saving
Parameters
$coupon Coupon Object
Example
function mepr_coupon_save_meta_fn($coupon) { // Do what you need } add_action('mepr-coupon-save-meta', 'mepr_coupon_save_meta_fn');
mepr-coupon-admin-enqueue-script
Description
Enqueue custom script on the Coupon edit page
Parameters
$hook String
Example
function mepr_coupon_admin_enqueue_script_fn($hook) { // Do what you need } add_action('mepr-coupon-admin-enqueue-script', 'mepr_coupon_admin_enqueue_script_fn');
mepr-account-is-active
Description
Do what you need when new transaction comes and is active
Parameters
$txn Transaction Object
Example
function mepr_account_is_active($txn) { // Do what you need } add_action('mepr-account-is-active', 'mepr_account_is_active');
mepr-account-is-inactive
Description
Do what you need when new transaction comes and is inactive
Parameters
$txn Transaction Object
Example
function mepr_account_is_inactive($txn) { // First make sure they're not active on another membership first $user = $txn->user(); $active_memberships = $user->active_product_subscriptions(); if(empty($active_memberships)) { // User has no active memberships } else { // User is still active on a different membership } } add_action('mepr-account-is-inactive', 'mepr_account_is_inactive');
mepr_menu
Description
Add submenu after Analytics submenu in the Dashboard
Example
function mepr_menu_fn() { // Add HTML code here } add_action('mepr_menu', 'mepr_menu_fn');
mepr_enqueue_scripts
Description
Enqueue custom script on MemberPress front-end pages like Membership page, Group page or Account page
Parameters
$is_product_page Boolean
$is_group_page Boolean
$is_account_page Boolean
Example
function mepr_enqueue_scripts($is_product_page, $is_group_page, $is_account_page) { // Do what you need } add_action('mepr_enqueue_scripts', 'mepr_enqueue_scripts', 10, 3);
mepr_payment_failure
Description
Do what you need when payment fails and error comes up
Parameters
$txn Transaction Object
Example
function mepr_payment_failure_fn($txn) { // Do what you need } add_action('mepr_payment_failure', 'mepr_payment_failure_fn');
mpcs_classroom_preview_menu
Description
Add menu item at the end of "Preview as" menu of courses pages with ReadyLaunch™ enabled.
Example
function mpcs_classroom_preview_menu_fn() { // Add HTML code here } add_action('mpcs_classroom_preview_menu', 'mpcs_classroom_preview_menu_fn');
mpcs_classroom_user_menu
Description
Add menu item at the end of user menu on courses pages with ReadyLaunch™ enabled.
Example
function mpcs_classroom_user_menu_fn() { // Add HTML code here } add_action('mpcs_classroom_user_menu', 'mpcs_classroom_user_menu_fn');
mpcs_classroom_start_header
Description
Add content before header of courses pages with ReadyLaunch™ enabled.
Example
function mpcs_classroom_start_header_fn() { // Add HTML code here } add_action('mpcs_classroom_start_header', 'mpcs_classroom_start_header_fn');
mpcs_classroom_end_header
Description
Add content at the end of the header of courses pages with ReadyLaunch™ enabled.
Example
function mpcs_classroom_end_header_fn() { // Add HTML code here } add_action('mpcs_classroom_end_header', 'mpcs_classroom_end_header_fn');
mpcs_classroom_start_sidebar
Description
Add content at the beginning of the sidebar of courses pages with ReadyLaunch™ enabled.
Example
function mpcs_classroom_start_sidebar_fn() { // Add HTML code here } add_action('mpcs_classroom_start_sidebar', 'mpcs_classroom_start_sidebar_fn');
mpcs_classroom_end_sidebar
Description
Add content at the end of the sidebar of courses pages with ReadyLaunch™ enabled.
Example
function mpcs_classroom_end_sidebar_fn() { // Add HTML code here } add_action('mpcs_classroom_end_sidebar', 'mpcs_classroom_end_sidebar_fn');
mpcs_courses_footer
Description
Add content to courses and lessons footer with ReadyLaunch™ enabled.
Example
function mpcs_courses_footer_fn() { // Add HTML code here } add_action('mpcs_courses_footer', 'mpcs_courses_footer_fn');
mpcs_classroom_start_instructor
Description
Add content before Instructor subpage with ReadyLaunch™ enabled.
Example
function mpcs_classroom_start_instructor_fn() { // Add HTML code here } add_action('mpcs_classroom_start_instructor', 'mpcs_classroom_start_instructor_fn');
mpcs_classroom_end_instructor
Description
Add content after Instructor subpage with ReadyLaunch™ enabled.
Example
function mpcs_classroom_end_instructor_fn() { // Add HTML code here } add_action('mpcs_classroom_end_instructor', 'mpcs_classroom_end_instructor_fn');
mpc_started_course
Description
Do action when users start a course
Parameters
$user_progress User Progress Object
Example
function mpc_started_course_fn($user_progress) { // Do something here } add_action('mpc_started_course', 'mpc_started_course_fn');
mpc_completed_course
Description
Do action when users complete a course
Parameters
$user_progress User Progress Object
Example
function mpc_completed_course_fn($user_progress) { // Do something here } add_action('mpc_completed_course', 'mpc_completed_course_fn');
mpc_started_section
Description
Do action when users start section
Parameters
$user_progress User Progress Object
$section_id Number
Example
function mpc_started_section_fn($user_progress, $section_id) { // Do something here } add_action('mpc_started_section', 'mpc_started_section_fn', 10, 2);
mpc_completed_section
Description
Do action when users complete section
Parameters
$user_progress User Progress Object
Example
function mpc_completed_section_fn($user_progress) { // Do something here } add_action('mpc_completed_section', 'mpc_completed_section_fn');
mpc_completed_lesson
Description
Do action when users complete lesson
Parameters
$user_progress User Progress Object
Example
function mpc_completed_lesson_fn($user_progress) { // Do something here } add_action('mpc_completed_lesson', 'mpc_completed_lesson_fn');
mpc_admin_general_options
Description
Add content at the end of Courses options in WordPress Dashboard > MemberPress Settings
Example
function mpc_admin_general_options_fn() { // Add HTML code here } add_action('mpc_admin_general_options', 'mpc_admin_general_options_fn');
mpca_add_sub_account
Description
Capture new sub-account added to corporate account event
Parameters
$transaction_id Number
$parent_transaction_id Number
Example
function catch_adding_sub_account($transaction_id, $parent_transaction_id) { // Do what you need } add_action('mpca_add_sub_account', 'catch_adding_sub_account', 10, 2);
mpca_remove_sub_account
Description
Capture sub-account removed from corporate account event
Parameters
$transaction_id Number
$parent_transaction_id Number
Example
function catch_removing_sub_account($transaction_id, $parent_transaction_id) { // Do what you need } add_action('mpca_remove_sub_account', 'catch_removing_sub_account', 10, 2);