Skip to content
  1. Extras
  2. Office
  3. Quick start

Quick start

We'll set up a user account with auth, profile editing, and miniShop2 order history.

Authorization

The account is available only to authorized users. We'll register them in the Users group.

Create it:

Assign context access Load, List and View.

Create section "Account" with 2 pages: "Profile" and "Order history". The account root should link to "Order history":

While configuring, hide the account from the menu. Remember to show it later.

Restrict access to these pages to the Users group only. Give group (anonymous) Load only so they can load the page, check access, and get "403 Access denied". Without Load only, the page won't exist for them and they'll get "404 Not found".

Create resource group Office, assign permissions, and add all 3 account pages.

Go to "Access control" and tighten access for Users and (anonymous) to this resource group; MODX sets slightly wrong defaults. For Users set Resource; for (anonymous) set Load, List and View.

Open the account page in incognito (not logged into manager) to see the main page.

To show the login page instead, create it and set its id in unauthorized_page.

In incognito you'll be asked to log in when accessing the account:

Call snippet officeAuth with groups so users are registered in Users, which has account access:

modx
[[!officeAuth?
  &groups=`Users`
]]

For HybridAuth auth see docs. To disable it:

modx
[[!officeAuth?
  &groups=`Users`
  &HybridAuth=`0`
]]

By default, HybridAuth cannot be used at registration. The user must first log in via email, then bind social networks in profile settings.

If a customer already placed an order with that email in miniShop2, they are already registered. They can reset the password, get it by email, log in and see their orders.

With this add-on you give all your customers access to their order history.

Profile editing

Main differences of officeProfile:

  • Works fully via ajax.
  • Lets you specify which profile fields can be filled.
  • Can require certain fields.
  • User can change username and email. For email change, an activation link is sent. Email changes only after the user clicks it.
  • Extended profile fields can be output and edited. They are allowed in settings and shown in the form as extended[field_name].
  • User can upload/remove profile image via ajax. If none, gravatar is used.
  • User can bind social networks (if enabled) for quick login.

All works out of the box.

modx
[[!officeProfile]]

You can pass parameters: disable HybridAuth, redirect on logout (default: current url), avatar upload params, etc. See snippet parameters in the manager.

Order output

Order history uses officeMiniShop2:

Built on ExtJS. Fields are set in system settings. You can change the look with custom CSS, but it's tedious.

Default settings suit most stores; you may want to remove the "weight" field.

Conclusion

You now know how to set up auth, profile editing, and miniShop2 order output on your site.