Jump to main content Jump to doc navigation

modX::checkForLocks

Checks for locking on a page. A page is “locked” if another user is already viewing it.

Syntax

string|false checkForLocks (integer $id, string $action, string $type)
  • $id (integer) ID of the user checking for the lock; if empty or 0, the current logged-in user is used
  • $action (string) The action identifying what is locked
  • $type (string) Message indicating the kind of lock being checked

Returns the translated lock_msg lexicon string (naming the user who holds the lock) if the page is locked, or false if it is not.

Example

Check for locks on the edit_chunk action.

$msg = $modx->checkForLocks($modx->getLoginUserID(), 'edit_chunk', 'edit');
if ($msg) {
    echo $msg;
}

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • A. Moreno
  • Alex
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • JT Skaggs
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$194 per month—let's make that $500!

Learn more