Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This simple patch allows you to implement two hooks in a custom module to extend the buddylist table header and row data. With it you can add more items into the table.
For example, http://dstaging.imedstudios.com/files/share/buddy_table.png, was created with
function sandbox_buddylist_buddypage_headers() {
$headers = array(t('favorite color'), t('action'));
return $headers;
}
function sandbox_buddylist_buddypage_rowvalues($bid) {
global $user;
$profile = (object)array('uid' => $bid);
profile_load_profile($profile);
return array($profile->profile_fav_color, '');
}
Comment | File | Size | Author |
---|---|---|---|
#4 | buddy_table.png | 26.96 KB | dldege |
#1 | extend_tables_2.txt | 1.99 KB | dldege |
extend_tables.txt | 1.97 KB | dldege |
Comments
Comment #1
dldege CreditAttribution: dldege commentedHere's a better version - I didn't realize I was already loading the user in theme('username'...
This version passes the loaded user object to the hook function for the row data instead of the uid.
So, to get, http://dstaging.imedstudios.com/files/share/buddy_table.png
do something like
Comment #2
dldege CreditAttribution: dldege commentedThe patch also adds a buddylist_table class to themed buddylist tables to make it simple to style these tables in your theme's CSS.
Comment #3
robertDouglass CreditAttribution: robertDouglass commentedthe pngs are no longer available, and I'm sure they are helpful in understanding the patch. Could you please make them available again? Thanks.
Comment #4
dldege CreditAttribution: dldege commentedThis is example output using this patch.