Hey,
Currently the way the ’manage web users’ tab is setup in Modx Manager is with fullname. I’d like to changed fullname to firstname lastname, two separate fields and have it show up like that in the Manager. What Modx file would I have to mess with to get something like that going?
Also, the way I’m creating login/logout is with email address and password, rather than username/password. I will be adding the email field to web_users table and delete it from the web_users_attributes.
My overall question is, if I change Modx backend stuff, when I upgrade to newer versions of it, will the upgrade change any of my specific settings?
Thanks,
Josh
-
☆ A M B ☆
- 24,524 Posts
Any changes you make to the core code will be overwritten if you upgrade.
To make the changes you want, you will need to make changes to several files and the database.
You can use email addresses as usernames without any changes. The email address must be in the web_users_attributes table for the user manager scripts to work properly.
You are, of course, free to hack away, but it will mean you will not have a clear upgrade path.
Personally I think that having the email address in web_users_attributes is short-sighted and pointless, and I’ve mentioned this previously. But that’s what we’ve got. So I don’t blame anyone for wanting to change it. And as many other systems have First Name, Last Name I can see why someone would want to change that.
However, you need to be prepared to reapply the changes each time you upgrade, and to expect issues with other snippets.
It is probably therefore easier to code up a web login snippet that uses web_users_attributes, as that doesn’t mean any changes to the core. (Personally, I’d make it look for username unless there was an @ sign, in which case it would look at the email logins).
If you’re changing Full name > First Name, Last Name, then that *will* need changing. I’d suggest adding the fields rather than removing Full Name, and populating Full Name whenever First Name & Last Name are changed. Removing a field will make stuff error; adding fields is harmless.
There are a number of MODx files you’d have to add to to get this to work; there’s like processors and actions and stuff. Search for one of the fieldnames from the form to find the pages.
If you’re doing a lot of customisations to web user management, then I’d recommend that you consider writing it as a distinct module. That way you would isolate your changes from the rest of MODx, and it would survive an upgrade.
In short, the methods of working alongside MODx should always be considered before hacking. It may take more time now, but it will save time later. And because you can then share your work, there’s a whole heap of other benefits too.
-
☆ A M B ☆
- 24,524 Posts
Just use an email for the username, and fill in the email field as well. That’s what I do in the RegisterX snippet.
I’m currently using the Weblogin snippet. Is the RegisterX better than the standard snippet?
-
☆ A M B ☆
- 24,524 Posts
RegisterX is unrelated. It’s intended to provide a simple way to have users register for ... whatever, such as newsletters or something. The user submits his email address, and a new web user is created with a random password, and assigned to a web user group you specify in the snippet call. Then you can do whatever you want with the users belonging to that group.
The point was that the web user is created with the username as the email address, and to satisfy the manager user system the email is also inserted into the web_users_attributes table.