Skip to content
  1. Extras
  2. Cabinet

Cabinet

Cabinet is an all-in-one solution for quick setup of a user cabinet in MODX Revolution. It suits both experienced developers and beginners.

✨ Main features

  • Automatic access rights setup
  • Automatic creation of pages and sections
  • Support for modal mode
  • Integration with social networks for registration and login
  • Phone verification via SMS/Voice OTP
  • Integration with extras:
  • E-commerce features:
    • Auto-login on first order
    • Order history and management
    • Reorder products
    • Order sharing
  • Flexible user profile management
  • CSRF protection
  • Integration with reCAPTCHA 3
  • Bootstrap 5
  • Native JavaScript

🎬 Demo video

Demo video

RuTube

🚀 Quick start

Installation

When installing, the following options are available in the install window:

  • User group for private pages (created automatically if missing)
  • Registration mode:
    • E-mail — with confirmation via email
    • Phone — with confirmation via SMS or call
  • Display mode:
    • Modal with AJAX
    • Standard pages
  • Settings for created pages:
    • Name
    • Alias
    • Parent resource
    • Access type (private/public)
    • Show in menu
    • Template
    • Content

Install settings

Main options

Registration and login

To output registration/login links and cabinet menu use the snippet:

modx
[[!cabinetLogin]]

When using modal mode, add to the footer of each page:

modx
[[!cabinetAuth]]

Registration form

Depending on the selected registration mode, in the cabinet.auth chunk the registration form can have a minimal set of fields:

  • For E-mail mode: email field only
  • For Phone mode: phone field only

By default, data confirmation is required on registration. To disable it, set the system option User activation (key cabinet_auth_activation) to No. With activation disabled, the registration form must include a password field.

⚙️ System settings

Authorization

Authorization options

SMS/Voice OTP

Provider settings

In system settings, section "OTP":

  1. Set the provider class in option SMS and Voice OTP provider class (cabinet_phone_handler_class)
  2. By default CabinetPhoneLog is set — a test provider that writes to the MODX log
  3. Configure the chosen provider in the corresponding configuration option

Operation mode settings

  • Choose OTP mode in option Phone OTP mode (cabinet_otp_phone_mode):
    • sms — confirmation via SMS
    • call — confirmation via call

Security settings

  • Set the code request limit in option Code request limit (cabinet_otp_phone_sending_limit)
  • Set lockout time in option Code request lockout time (cabinet_otp_phone_sending_lock_time)
    • Value is in minutes
    • Default: 360 minutes (6 hours)

Supported providers

ProviderCountrySMSVoiceConfig option
CabinetGreenSmsRUcabinet_greensms_config
CabinetTeraSmsRUcabinet_terasms_config
CabinetAlphaSmsUAcabinet_alphasms_config
CabinetSmsClubMobiUAcabinet_smsclubmobi_config
CabinetPhoneLogDemo-

New providers can be added at no cost if a PHP API library is available.

OTP options

Social networks

Main settings

In the package system settings, section "Social networks", the following options are available:

  1. Use social networks (key cabinet_social_providers): Comma-separated list of social network names available to the user for registration and login.

  2. User login via social networks (key cabinet_social_login): Allow or disallow users to log in via social networks.

  3. Register new users via social networks (key cabinet_social_signup):

  • Allow or disallow new user registration via social networks.
  • If registration is off but "User login via social networks" is on, users can add social networks for login in their profile settings.
  1. Enable social networks (key cabinet_enable_socials): Globally enable or disable use of social networks.

Supported social networks

NetworkConfig option
Googlecabinet_social_Google
Yandexcabinet_social_Yandex
Mailrucabinet_social_Mailru
Vkontaktecabinet_social_Vkontakte
Odnoklassnikicabinet_social_Odnoklassniki
Facebookcabinet_social_Facebook
Instagramcabinet_social_Instagram
Twittercabinet_social_Twitter
LinkedIncabinet_social_LinkedIn
GitHubcabinet_social_GitHub

Instructions for obtaining API keys for most providers can be found here.

Social network options

Security

Security options

reCAPTCHA 3

Integration with Google reCAPTCHA 3 for protection against automated attacks.

reCAPTCHA 3 options

🧩 Snippets

cabinetLogin

Snippet for outputting registration/login links or the logged-in user menu.

Parameters

ParameterDefaultDescription
cabinetPageId0Cabinet page ID. If 0, value from system option cabinet_home_page_id is used
loginPageId0Post-login page ID. If 0, value from system option cabinet_login_page_id is used
logoutPageId0Post-logout page ID. If 0, value from system option cabinet_logout_page_id is used
tplcabinet.loginDisplay chunk
tplWrapper-Wrapper chunk
gravatarUrlhttps://gravatar.com/avatar/Gravatar service URL
css-Path to CSS file
js-Path to JavaScript file

cabinetAuth

Snippet for outputting login, registration and password recovery forms.

Parameters

NameDefaultDescription
groups-Comma-separated list of groups for user registration. If empty, value from system option cabinet_auth_user_group is used
addContexts-Additional contexts, comma-separated. E.g. &addContexts=web,ru,en
widgetloginActive form widget. Allowed values: login; register; recovery
loginPageId0Page ID to send the user to after login. If 0, value from system option cabinet_login_page_id is used
logoutPageId0Page ID to send the user to after logout. If 0, value from system option cabinet_logout_page_id is used
tplcabinet.loginChunk name for snippet output
tplWrappercabinet.auth.wrapperWrapper chunk name for snippet output
tplMessageWrappercabinet.message.wrapperChunk name for form message wrapper
css{assets_url}components/cabinet/css/web/auth.cssPath to CSS file
js{assets_url}components/cabinet/js/web/auth.jsPath to JavaScript file

cabinetProfile

Snippet for outputting the user profile form.

Parameters

NameDefaultDescription
allowedFieldsusername:50, email:50, fullname:50, phone:12, mobilephone:12, dob:10, gender, address, country, city, state, zip, fax, comment, specifiedpassword, confirmpasswordComma-separated list of user fields allowed for editing. You can also set max length with a colon.
avatar{"w":200,"h":200,"zc":0,"bg":"ffffff","f":"jpg"}JSON string with phpThumb conversion parameters for the avatar
avatarPathimages/avatar/Directory for user avatars inside MODX_ASSETS_PATH
gravatarUrlhttps://gravatar.com/avatar/Gravatar URL
requiredFieldsusername,emailList of required fields when editing. These must be filled for a successful profile update.
tplcabinet.profileChunk name for snippet output
tplWrappercabinet.profile.wrapperWrapper chunk name for snippet output
tplMessageWrappercabinet.message.wrapperChunk name for form message wrapper
css{assets_url}components/cabinet/css/web/profile.cssPath to CSS file
js{assets_url}components/cabinet/js/web/profile.jsPath to JavaScript file

cabinetOrders

Snippet for outputting the user's order list.

Order list output

Parameters

NameDefaultDescription
statusAlias-JSON string with alternative order status IDs. E.g. {6:1,8:11} where 6 is current order status and 1 is the status shown to the client
allowCancelStatuses1Comma-separated list of order status IDs for which the client can cancel the order
cancelledStatus4Status ID for orders cancelled by the client
excludeStatuses5Comma-separated list of order status IDs to exclude from the filter
criteriaAvailability{"published":1,"deleted":0}. Example of extending default: {"price:>":0,"count:!=":0}JSON string with additional product availability criteria for ordering
sharePageId0Page ID for shared order output. If 0, value from system option cabinet_shared_order_page_id is used
detailsPageId0Page ID for order details. If 0, value from system option cabinet_order_details_page_id is used
thumbsComma-separated list of thumbnail sizes. E.g. "120x90,360x240" gives placeholders [[+120x90]] and [[+360x240]]. Images must be pre-generated in the product gallery
currencySymbolsymbol_rightCurrency symbol column in msMultiCurrency. Allowed values: symbol_left; symbol_right
limit12Maximum number of results
offset0Number of results to skip
sortbycreatedonSort field
sortdirDESCSort direction
whereAdditional query parameters, JSON-encoded
returntplOutput method. Allowed values: tpl and data
tplcabinet.ordersChunk name for snippet output
tplWrapper-Wrapper chunk name for snippet output
tplMessageWrappercabinet.message.wrapperChunk name for form message wrapper
css-Path to CSS file
js{assets_url}components/cabinet/js/web/orders.jsPath to JavaScript file

cabinetOrderDetails

Snippet for outputting order details.

Order details output

Parameters

NameDefaultDescription
tplcabinet.order.detailsChunk name for snippet output

This snippet is a wrapper over cabinetOrders and accepts all its parameters.

cabinetOrdersStats

Snippet for outputting overall order statistics.

Parameters

NameDefaultDescription
activeStatuses1Comma-separated list of active order status IDs
cancelledStatuses4Comma-separated list of cancelled order status IDs
completedStatuses2,3Comma-separated list of completed order status IDs
currencySymbolsymbol_rightCurrency symbol column in msMultiCurrency. Allowed values: symbol_left; symbol_right
returntplOutput method. Allowed values: tpl and data
tplcabinet.orders.statsChunk name for snippet output
tplWrapper-Wrapper chunk name for snippet output
css-Path to CSS file
js-Path to JavaScript file

cabinetSharedOrder

Snippet for outputting a shared order.

Parameters

NameDefaultDescription
thumbsComma-separated list of thumbnail sizes. E.g. "120x90,360x240" gives placeholders +120x90 and +360x240. Images must be pre-generated in the product gallery
currencySymbolsymbol_rightCurrency symbol column in msMultiCurrency. Allowed values: symbol_left; symbol_right
tplcabinet.shared.orderChunk name for snippet output
tplWrapper-Wrapper chunk name for snippet output
tplMessageWrappercabinet.message.wrapperChunk name for form message wrapper
css-Path to CSS file
js-Path to JavaScript file

📫 System events

cabinetBeforeMakeUrl

Event before URL creation.

Parameters

ParameterDescription
idResource ID
urlFinal URL (if not empty, cabinetMakeUrl will not run)
contextContext for URL creation scope
argsQuery string
schemeURL format
optionsOptions array
toolsCabinetTools instance

cabinetMakeUrl

URL creation event.

Parameters

NameDescription
idResource ID for which the URL is created
urlFinal URL value
contextContext that limits URL creation
argsQuery string appended to the generated URL
schemeScheme in which the URL is created
optionsOptions array for resource URL creation
toolsCabinetTools instance

cabinetIsAvailableProduct

Event for product availability status for ordering.

Parameters

NameDescription
idProduct ID
dataProduct data as array
availableAvailability. Allowed values 0 and 1
toolsCabinetTools instance

cabinetBeforePrepareOrderProduct

Event for preparing order product data.

Parameters

NameDescription
order_idOrder ID
product_idProduct ID
dataProduct data as array
ordermsOrder instance
toolsCabinetTools instance

cabinetBeforeUploadAvatar

Event before avatar upload.

Parameters

NameDescription
userIdUser ID
usermodUser instance
fileAvatar file
toolsCabinetTools instance

cabinetUploadAvatar

Avatar upload event.

Parameters

NameDescription
userIdUser ID
usermodUser instance
fileAvatar file
urlURL of uploaded avatar
toolsCabinetTools instance

cabinetBeforeRemoveAvatar

Event before avatar removal.

Parameters

NameDescription
userIdUser ID
usermodUser instance
fileAvatar file
toolsCabinetTools instance

cabinetRemoveAvatar

Avatar removal event.

Parameters

NameDescription
userIdUser ID
usermodUser instance
toolsCabinetTools instance

💻 Development

Lexicons

All messages and notifications are in lexicons:

  • Topic auth: authorization messages
  • Topic profile: profile messages

Console scripts

core/components/cabinet/scripts/generate_orders_share_key.php Script for generating order sharing keys for orders created before Cabinet was installed.