I have been using the below method for several months now and it has worked really well for me and would like to see it built-in to ModX.
Everyone has different fields they want to include for User profile information and there is no way you can include fields that meets everyone needs. What I have been doing is I made the comment field of web_user_attributes
longtext and then use the following code at the top of all my snippets:
global $modx;
$_userID = $modx->getLoginUserID();
if ($_userID) {
$User = $modx->getWebUserInfo($_userID);
if ($User[comment]) {
preg_match('|<security_level>(.*)</security_level>|', $User[comment], $matches);
$User[security_level] = $matches[1];
}
}
Using the above code, all I have to do is include <security_level>7</security_level> in the comment section and voila, now I have a $User variable called $User[security_level]. With this method, I can include only the fields that are relative to each user. I normally include one tag on each line followed by a return.
So ... it would be nice to add a
longtext box to the User profile page entitled XML Variables or something similar which ModX would automatically read and apply all tags in that users profile to the $User variable (or some other variable).
Additionally, using this method, no mass changes to the web_user_attributes table would need to be made, which would take away the concern of updates and the need to alter a table structure each time an update so required.
I hope this makes sense, because the concept has really worked well for me with ModX.