For developers, the Invite Only Membership Add On has one filter hook that controls whether invite codes keep working after the owner’s membership ends, plus helper functions for showing a member’s codes in your own templates.
Filters
pmproio_check_user
Determines whether an invite code is rejected because the member who owns it no longer has an active membership level. The filter only runs when the code’s owner has no level. Return false to accept codes from members whose membership has ended. The filter doesn’t receive the code or the user, so the change applies to every code on your site. The code must still belong to a member and be under its use limit.
apply_filters( 'pmproio_check_user', bool $check_user );
Parameters
$check_user: bool; Whether to reject codes owned by members without an active membership level. Defaulttrue.
Example
// Keep invite codes working after the owner's membership ends.
add_filter( 'pmproio_check_user', '__return_false' );
Functions
pmproio_getInviteCodes
Gets a member’s invite codes. Returns false if the member has no codes.
pmproio_getInviteCodes( int $user_id = null, bool $sort_codes = false );
Parameters
$user_id: int; The member’s user ID. Defaults to the current user. Pass the ID explicitly.$sort_codes: bool; Whenfalse(default), returns a flat array of every code. Whentrue, returns an array with two keys:unused(codes that still have uses left) andused(each used code mapped to an array of the user IDs that checked out with it).
pmproio_displayInviteCodes
Returns the HTML the Add On uses on the Membership Account page: a read-only box of unused codes and/or the table of used codes. Returns false if the member has no codes.
pmproio_displayInviteCodes( int $user_id = null, bool $unused = true, bool $used = false );
Parameters
$user_id: int; The member’s user ID. Defaults to the current user.$unused: bool; Whether to include the box of codes that still have uses left. Defaulttrue.$used: bool; Whether to include the Used Invite Codes table. Defaultfalse.
Example
// Show the current member's unused invite codes with a custom shortcode.
function my_pmproio_invite_codes_shortcode() {
if ( ! is_user_logged_in() || ! function_exists( 'pmproio_displayInviteCodes' ) ) {
return '';
}
$html = pmproio_displayInviteCodes( get_current_user_id() );
return empty( $html ) ? '' : $html;
}
add_shortcode( 'my_invite_codes', 'my_pmproio_invite_codes_shortcode' );
Get Support From Our Team of Experts
Have a question about how to use this feature? Our Support Page outlines three ways to get support.
Our Max plans include hands-on help customizing your membership site and implementing new features. Upgrade to PMPro Max now »
Last updated on November 19, 2026