Active
Project:
Buddylist
Version:
master
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Apr 2007 at 19:50 UTC
Updated:
13 Apr 2007 at 12:30 UTC
Can anyone help me out?
The included code:
function phptemplate_username($object) {
global $user;
/* Use the default theme_username for anonymous users, nodes by this user */
if ($user->uid == 0 || $object->uid == $user->uid || $object->uid == 0) {
return theme_username($object);
}
if (!user_access('maintain buddy list')) {
return theme_username($object);
}
/* an array, keyed on buddy uids */
$buddies = buddylist_get_buddies($user->uid);
/* Find out if this buddy is in the user's buddy list */
foreach ($buddies as $buddyuid => $buddystructure) {
if ($buddyuid == $object->uid) {
$output .= theme_username($object);
$output .= ' (';
$output .= theme('remove_from_buddylist_link', $object);
$output .= ')';
return $output;
}
}
/* The user is not in the buddylist, give a link to add */
$output .= theme_username($object);
$output .= ' (';
$output .= theme('add_to_buddylist_link', $object);
$output .= ')';
return $output;
}Places 'add to buddylist' wherever it finds a username mentioned. Thats good, but I find it pretty annoying, is there a way to adapt this code so I can just put 'add to buddylist' in places of my choosing? In particular i am thinking of user list pages...
Thanks for any help :)
Comments
Comment #1
michelleI just used the last comment here and it works:
http://drupal.org/node/35738
Michelle