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. Default true.

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; When false (default), returns a flat array of every code. When true, returns an array with two keys: unused (codes that still have uses left) and used (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. Default true.
  • $used: bool; Whether to include the Used Invite Codes table. Default false.

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' );

Last updated on November 19, 2026


Was this article helpful?
YesNo