[Typo3] Sorting newloginbox userlisting by custom field

Ben Chapman ben.chapman at emory.edu
Wed Jul 13 18:55:04 CEST 2005


Ben Chapman wrote:
> Hello!
> 
> We would like to use the newloginbox userlisting to list our faculty 
> members. However, we need to be able to sort by last name. I used the 
> kickstarter to extend fe_users to add last name (surname or family name) 
> and first name (given name) fields. We can now display the information 
> on our site like this:
> 
> http://www.law.emory.edu/cms/site/index.php?id=806
> 
> However, I cannot find a way to sort by the new fields created by the 
> extension that added the two new fields to the database. I apologize if 
> this is obvious to others, but can anyone tell me what I need to do next 
> to get the sorting?
> 
> Best regards,
> 
> Ben Chapman
> Emory University School of Law
> ben.chapman at emory.edu
Group:

Thanks to Zach Davis for the solution to this one. I'll document it in 
case others have the same issue. In our case, we have an ldap directory 
that provides information about our faculty and staff. We use the LDAP 
directory to populate a sysfolder that contains front end users. In 
order to add additional fields to the fe_users table, we wrote a very 
basic extension that adds two fields, last name and first name.

The database fields are then filled from the LDAP directory.

However, in order to sort by the new database fields, modifications to 
the newloginbox code are required. Go to: ext/newloginbox/pi3
and edit class.tx_newloginbox_pi3.php. Locate the variable
$this->internal['orderByList'] and add your new fields to the list 
there. If you want to make the new fields searchable, add them to the 
$this->internal['searchFieldList'] array as well.

Finally, if you want something other than userid to trigger the link to 
a single item display, add that field to the switch statement around 
line 500, so that it looks something like this:

  switch($fN) {          case 'tx_elsfeusers_lname':
                         case 'name':
                         case 'username':

In our case, we added in "case 'tx_elsfeusers_lname':" to the list. This 
will activate our last name field as a key to the single item display.

I hope this is helpful to someone; thanks again to Zach for his help. If 
you have any questions, please email me.

Best,

Ben Chapman
ben.chapman at emory.edu




More information about the TYPO3-english mailing list