1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Howto: Show Horde/Turba address book sorted by name

Discussion in 'Plesk for Linux - 8.x and Older' started by zymsys, Oct 20, 2005.

  1. zymsys

    zymsys Guest

    0
     
    One of my clients was complaining that the address book in Horde wasn't sorted when used in composing emails. I couldn't find a built-in way to do this, but I did this little hack which helps. Unfortunately it doesn't re-sort when they display email addresses instead of names, but its better than it was.

    Edit /usr/share/psa-horde/imp/contacts.php and find this block of code:
    Code:
    /* The results list returns an array for each source searched - at least
     * that's how it looks to me. Make it all one array instead. */
    $addresses = array();
    foreach ($results as $r) {
        $addresses = array_merge($addresses, $r);
    }
    
    Under that add this:
    Code:
    function cmpaddr($a,$b)
    {
            return strcasecmp(trim($a['name']),trim($b['name']));
    }
    
    usort($addresses,'cmpaddr');
    
    I thought some of you could use this. More importantly I'll know where to find it when an upgrade overwrites the file!
     
Loading...