
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:
Note: call snippet officeAuth with parameter groups so that users are registered in the Users group, which has access to the account:
[[!officeAuth?
&groups=`Users`
]]It is straightforward once you get the idea. To set up auth via HybridAuth see docs. To disable it:
[[!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. I prefer to configure it — it is more convenient for visitors.
All auth snippet parameters are on its page in the manager. If a customer already placed an order with that email in miniShop2, they are already in the system and cannot register again. They can reset the password, receive it by email, log in to the account and see all their orders.
So with this add-on you give all your customers access to their saved order history.
Profile editing
Main differences of officeProfile from other profile-edit solutions:
- It works entirely 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 of this works out of the box, no extra setup.
The snippet is called very simply:
[[!officeProfile]]You can pass extra parameters: disable HybridAuth, where to redirect on logout (default: current url), avatar upload options, etc. I won’t list them all here; you can see everything in its parameters in the manager.
Order output
Order history is output with snippet officeMiniShop2:
It is built on ExtJS and is very convenient. It is loaded from the installed MODX, so the look may vary slightly between MODX versions. Which fields to show is set in system settings. You can also fully change the ExtJS look with your own CSS file, but that is rather tedious — fair warning.
Default settings suit most stores; you may only need to remove the "weight" field.
Conclusion
You now know how to set up auth, profile editing, and miniShop2 order history on your site in a simple way.


















