Prev |  | Next

## 3.18. Buddies system

### 3.18.1. buddy_list

(Phorum 5 >= 5.2.7)

This hook can be used for reformatting a list of buddies. Reformatting could mean things like changing the sort order or modifying the fields in the buddy arrays.

Call time:

Right after Phorum has formatted the buddy list. This is primarily done when the list of buddies is shown in the private message system.

Hook input:

An array of buddy info arrays. Each info array contains a couple of fields that describe the budy: user_id, display_name, mutual (0 = not mutual, 1 = mutual), URL->PROFILE, date_last_active (formatted date) and raw_date_last_active (Epoch timestamp).

Hook output:

The same array as was used for the hook call argument, possibly with some updated fields in it.

Example code:

    function phorum_mod_foo_buddy_list($buddies)
    {
        // Add a CSS class around the display names for
        // the mutual buddies (of course this could also
        // easily be implemented as a pure template change,
        // but remember that this is just an example).
        foreach ($buddies as $id => $buddy)
        {
            if ($buddy['mutual'])
            {
                $buddies[$id]['display_name'] =
                    '<span class="mutual_buddy">' .
                    $buddy['display_name'] .
                    '</span>';
            }
        }

        return $buddies;
    }

Prev | Up | Next
| Home |