museumsandtheweb.com - Comments for "buddylist" http://www.museumsandtheweb.com/forum/buddylist Comments for "buddylist" en didn't do this part... last night -- done now http://www.museumsandtheweb.com/forum/buddylist#comment-4 <p>5. Optionally add the following theme function to your PHPTemplate's template.php file:</p> <p>function phptemplate_username($object) {<br /> global $user;<br /> /* Use the default theme_username for anonymous users, nodes by this user */<br /> if ($user-&gt;uid == 0 || $object-&gt;uid == $user-&gt;uid || $object-&gt;uid == 0) {<br /> return theme_username($object);<br /> }<br /> if (!user_access('maintain buddy list')) {<br /> return theme_username($object);<br /> }</p> <p> /* an array, keyed on buddy uids */<br /> $buddies = buddylist_get_buddies($user-&gt;uid);<br /> /* Find out if this buddy is in the user's buddy list */<br /> foreach ($buddies as $buddyuid =&gt; $buddystructure) {<br /> if ($buddyuid == $object-&gt;uid) {<br /> $output .= theme_username($object);<br /> $output .= " (";<br /> $output .= theme('remove_from_buddylist_link', $object);<br /> $output .= ")";<br /> return $output;<br /> }<br /> }<br /> /* The user is not in the buddylist, give a link to add */<br /> $output .= theme_username($object);<br /> $output .= " (";<br /> $output .= theme('add_to_buddylist_link', $object);<br /> $output .= ")";<br /> return $output;<br /> }</p> <p>j. trant<br /> archives &amp; museum informatics<br /> <a href="http://www.archimuse.com" title="www.archimuse.com">www.archimuse.com</a></p> Wed, 22 Mar 2006 05:50:50 +0000 jtrant comment 4 at http://www.museumsandtheweb.com