Jump to main content Jump to doc navigation

modX::sendUnauthorizedPage

Send the user to the MODX unauthorized page.

Syntax

void sendUnauthorizedPage ([array $options = null])

Before forwarding, the OnPageUnauthorized event is invoked with $options. The user is then sent to the resource configured in the unauthorized_page setting, falling back to site_start if that is not set.

$options may override the defaults filled from the unauthorized_page_header, unauthorized_page_pagetitle and unauthorized_page_message settings:

  • response_code, error_header — HTTP header line (default 401 Unauthorized)
  • error_type — error type passed on to sendError, default 401
  • error_pagetitle — default Error 401: Unauthorized
  • error_message — default <h1>Unauthorized</h1><p>You are not authorized to view the requested content.</p>
  • unauthorized_page — resource id of the unauthorized page for this call only

Example

Send the user to the unauthorized page. You do not need to terminate the script after running this.

$modx->sendUnauthorizedPage();

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
  • YJ
  • Murray Wood
  • JT Skaggs
  • Anton Tarasov
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

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

Learn more