However, I do not think using user_settings is the best way for an Employee Directory.
1) It is counterintuitive.
The user’s phone number is already stored in the "phone" field of user_attributes / web_user_attributes. As is "fullname", "email, "mobilephone" etc. It appears to me that _settings are more "optional" settings, like "which days of the week can they access", etc. Every (human) user has a first name and a last name. Unless Madonna is on the payroll. Even so, it’s more likely than having a mobile phone. So adding 2 fields (firstname & lastname) to _attributes makes sense.
2) There is little benefit to the Manager in this instance.
Given that one would have to hack "mutate_user.dynamic.action.php" to add the fields/quasi-fields to either tab, there’s no benefit there. (If there was an User Setting Editor allowing you to add settings as if they were template variables, this reason would be void).
3) There is little benefit to Any Other Script in this instance.
It is obviously easier to add/update "fullname", "first_name", "last_name" and "phone" data at the same time. (If there was an API feature for checking for the existence of a user_setting entry and either adding one or amending the existing one, this reason would be void).
4) It is harder to sort properly by last_name, first_name if both are in the same table.
CompareSELECT * FROM modx_user_attributes ORDER BY last_name, first_name
withSELECT * FROM modx_user_settings US1, modx_user_settings US2 WHERE US1.user = US2.user AND US1.setting_name = 'first_name' AND US2.setting_name = 'last_name' ORDER BY US1.setting_value, US2.setting_value
Now try adding the phone number, or worse another _settings value.
5) Before anyone says it, any "future db versions do it more like _settings than _attributes" argument doesn’t wash.
Any major change of data model would need to convert the _attributes anyway.
So whilst I welcome being reminded of the _settings table, my opinion is that it is better to add fields to _attributes.
Field for sorting
One thing worth considering in place of "firstname" / "lastname" is "SortBy".
That way "Bruce Forsyth" would be "Forsyth Bruce", "Scott McQueen" would be "MacQueen Scott" etc. That may well be better if you have lots of names where the traditional human sorting is different from what would be achieved by Lastname, Firstname sort (eg cultural differences). It is also a field used in Outlook, which may well be the source of the employee data.
Personnally, even if I understand the benefits of separating business logic from the CMS data structure, I chose to use TVs to do just that... mainly because it’s a small company (65 people), no outside source of data, and also because it allowed for QuickEdit in the frontend which a definite plus.
I had a client who requested and employee directory and it works just fine with TVs and Ditto...
Sample here : http://www.michelez-notaires.com/repertoire/alphabetique.html#A ( a french website).
<h1 id="A">A</h1> [[NewsListing? &startID=`72` &tpl=`fiche_alpha` &filter=`tvalpha,A,1` &hiddentv=`alpha` &sortdir=`asc` &summarize=`500` &hidefolders=`true` &emptytext=``]] <h1 id="B">B</h1> [[NewsListing? &startID=`72` &tpl=`fiche_alpha` &filter=`tvalpha,B,1` &hiddentv=`alpha` &hidefolders=`true` &sortdir=`asc` &summarize=`500` &emptytext=``]] <h1 id="C">C</h1> [[NewsListing? &startID=`72` &tpl=`fiche_alpha` &filter=`tvalpha,C,1` &hiddentv=`alpha` &hidefolders=`true` &sortdir=`asc` &summarize=`500` &emptytext=``]] ... and so on.
<div class="fiche"><h3><a href="[~[+id+]~]" title="Consulter la fiche de [+tvprenom+] [+tvnom+]">[+tvprenom+] [+tvnom+]</a> - [+tvfonction+]</h3></div>
<div class="fiche">
<h3>[*prenom*] [*nom*]</h3>
<table id="detail">
<tr>
<th>Fonction :</th>
<td>[*fonction*]</td>
</tr>
<tr>
<th>Ligne Directe:</th>
<td>[*tel*]</td>
</tr>
<tr>
<th>Fax Direct:</th>
<td>[*fax*]</td>
</tr>
<tr>
<th>Email :</th>
<td><a href="mailto:[*email*]" title="Ecrire à [*prenom*] [*nom*]" style="text-decoration: none">[*email*]</a></td>
</tr>
</table>
</div>