[support] Recreating "Buddylist" block on customised userpage

Neil: esl-lounge.com neil at esl-lounge.com
Tue Oct 23 08:58:22 UTC 2007


I would like to recreate the Buddylist block I get on user pages (user/1, user/2, etc) which looks, after a bit of localisation changing, like this:

---------------------------------------
Contact List

    Contacts:
  a.. Phil
  b.. John
  c.. Mike
    Contact Of:
  a.. John
  b.. Mike
  c.. Caroline
(if I go to John's page) Remove John from your Contact List.
(if I go to Cherie's page) Add Cherie to your Contact List.
---------------------------------------

I checked out http://drupal.org/node/35738 and http://drupal.org/node/36501 but the code seems to be giving me info based on MY buddylist, whichever page I'm viewing. (I think this is because on my customised user_profile.tpl.php file, I call global $user earlier in the code.

I did get the following snippet from the drupal forum to get the user page user, not the viewing user:

<?php
$temp_user = array('uid' => arg(1));
$user_page_user = user_load($temp_user );
?>

So if I put:

<p>My name is <?php print $user->name ?></p>
<p>My name is <?php print $user_page_user->name ?></p>

I get first my name (viewing user) printed and then the name of the person whose page I'm viewing (viewed user). Believe me, I've been tearing my hair out about these "viewing user", "viewed user" differences for 3 days!

But I don't seem to be able to incorporate $user_page_user into the buddylist snippet. It always shows me MY buddies, whichever page I'm on. Could someone point me in the right direction?

.....and stop a grown man crying. :-(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20071023/ec663f45/attachment-0001.htm 


More information about the support mailing list