Postponed (maintainer needs more info)
Project:
Buddylist2
Version:
5.x-1.x-dev
Component:
Buddylist UI
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Feb 2008 at 05:21 UTC
Updated:
1 Apr 2008 at 17:02 UTC
Comments
Comment #1
crizHi, displaying a "buddy-add link" on other pages than the user-page is very easy: Just create a link with an relative url like "/buddy/add/UID", where UID is the User ID of the user that should be added to your buddylist.
Comment #2
nodestroy commentedHi,
i have added this links to the book page:
http://drupal.org/node/217087
regards
Comment #3
sterwa commentedYou guys,
your solution is not flexible enough. If I create a link like "/buddy/add/UID", it will be displayed everywhere regardless of whether this UID is already a friend of current user or not.
I am trying to add buddy action buttons to author's info block. I am retrieving a author's ID using
(the $node I received by loading a node for nid fetched from the URL)
Then I am getting the author-of-node user object with
Now, I want to take advantage of the function theme_buddylist_ui_user_actions. I write the following:
And what it prints says "Array". I think i am not getting something basic related to displaying arrays... Any help would be appreciated.
Comment #4
crizHi, do you have seen this snippet? It should accomplish what you are asking for...
Comment #5
sterwa commentedThanks criz for the tip, that snippet does work!!!
I guess my question is more general regarding printing out arrays in Drupal.
See,
what that snippet does in 6 lines of code, my line does in one, by taking advantage of the appropriate API (that does all the reading my buddies computations for me). But it fails to output the result properly. I would like to understand how to print arrays. Right now, if I use print_r to display the content of the array, I get correct list of actions. But wrapped in ugly form-looking wrapping. Ideas on how to print forms? Here is what I get displayed when running:
Displayed result:
Array ( [title] => Buddy actions [value] =>
* Add CorrectPuserNickname to my buddylist
[class] => buddylist_actions )
Tis is not to undermine the utility of your snippet, criz, but for educational purposes (and the purpose of code efficiency)...
Comment #6
Fixdit commentedComment #7
Fixdit commentedHello,
I have looked around and done the research, but haven't been able to manage to implement these buttons using BL2.
PHP snippets that I have seen just haven't got to work?
http://drupal.org/node/226423#comment-747395
The way I have been doing it is using the 'mini panels'. I have tried adding snippets to the user profiles by creating a panel in the 'basic info' mini pane and enabling it to recognise PHP.
I've experienced some of the problems flagged up during previous postings, but not come to any 'fixed' conclusion. What am I doing wrong? Is there another way this feature should now be implemented rather than using panels/min panels?
Comment #8
nodestroy commentedhi,
maybe you can post what you have done exactly (with code). at the moment i can just guess...
Comment #9
Fixdit commentedI'll be working on this today so I can post more later on. I wonder if it because the right variables for the user and the account being viewed are incorrect? Here is the code I have posted into my mini panel using 'Advanced Profile' module.
Do you think it's something to do with the $account variable not being passed?
Comment #10
nodestroy commentedtry with this one ;)
Comment #11
Fixdit commentedThat looks good to me, but it hasn't worked. The link stays the same on every profile users page "Add to your contact list" and when clicked just displays the message: "This user does not exist"
The link is:
http://localhost:8888/dev_alpha/buddy/add/0?destination=user%2F1
I'm stumped?! Your snippet looks like it should do the job. Any ideas? How have you got this configured in the past?
Comment #12
nodestroy commentedfrom here i can´t say whats wrong with your system. you posted a local link...i can´t access your site.
but at your URL i can see, that the profile-owner is not loaded correctly. buddy/add/uid is the syntax of the callback, and a 0 is passed to it. the third argument hast to be a user-uid.
that means $puser->uid is not correct -> $puser = user_load(array('uid' => $node->uid)); is not correct.
try to output $node->uid.
Comment #13
Fixdit commentedThanks nodestroy,
figured the puser array wasn't loading the users info. I tried some test outputs and got nothing back.
Outputed:
"Test-output:"
Could it be something to do with the panles and where the block is being viewed? Perhaps the array is out of alignment with where it needs to be accessing.. if you see what I mean?
Comment #14
Fixdit commentedIf you' ve ever used Panels 2 for this, do you think it could be something to do with the 'contexts' getting passed? Let me know if more explanation of this is required.
Comment #15
nodestroy commentedi think, this is a panels issue.
you have to get the node->uid from the node you embed the panel, then your php snippet should work. please create a panels issue to get your needed informations.
your user profile -> block -> panel -> snippet
^- contains the uid you need (has to be available when executing the php code)
regards,
dominik
Comment #16
majsan commentedI get about the same problem. I get
mypath/buddy/add/0?destination=user/3
which gives me "The user doesn't exist".
I use clean URLs but that shouldn't matter, should it?
Comment #17
crizIf you want to use the snippet in a block outside a node or the userpage, you will have to care that $uid is available. $node would not be available then.
How do you do this? It depends where you want do display your block. Assuming you want to display the block in context to the userpage (/user/UID) you would have to change
into
But I have not tested this, please report back. If you use Panels or you want to display the block in context to a node (e.g. userprofile as node) you would have to load $uid in a different way (I guess with panels2 you will have to work with arguments). Maybe we could sum up this stuff in the documentation section sometimes.
Comment #18
majsan commentedI do not use panels but have exactly the same problem.
(This is reply to #14)