The Lock Membership Level Add On doesn’t offer its own action or filter hooks. Developers can use these functions in custom code to add, remove, or check a member’s locks, for example to lock a large group of existing members at once.

Functions

pmprolml_add_lock_for_user()

Adds a lock to a user. If the user already has a lock for the same level, that lock is replaced.

pmprolml_add_lock_for_user( int $user_id, int $level_id, int $expiration, int $payments_required = 0 );

Parameters

  • $user_id: int; The user ID to lock.
  • $level_id: int; The level ID to lock, or 0 to lock all levels.
  • $expiration: int; A Unix timestamp (UTC) when the lock expires, or 0 for no expiration.
  • $payments_required: int; The number of successful payments required to unlock, or 0 to not use a payment count. Default 0.

pmprolml_delete_lock_for_user()

Deletes a user’s lock for a level.

pmprolml_delete_lock_for_user( int $user_id, int $level_id );

Parameters

  • $user_id: int; The user ID.
  • $level_id: int; The level ID of the lock to delete, or 0 to delete the All Levels lock.

pmprolml_is_level_locked_for_user()

Checks whether a level is locked for a user. Returns true if the user has an active lock on that level or an active All Levels lock.

pmprolml_is_level_locked_for_user( int $user_id, int $level_id );

Parameters

  • $user_id: int; The user ID to check.
  • $level_id: int; The level ID to check. Pass 0 to check only for an All Levels lock.

pmprolml_get_locks_for_user()

Returns an array of the user’s active locks. Expired date-based locks and payment-based locks whose payment count has been reached are not included. Each lock is an array with level_id (0 for All Levels), expiration, and payments_required keys. Locks saved before version 1.1 may not have a payments_required key.

pmprolml_get_locks_for_user( int $user_id );

Parameters

  • $user_id: int; The user ID.

Last updated on November 12, 2026


Was this article helpful?
YesNo