Closed (fixed)
Project:
User Relationships
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
21 Oct 2008 at 21:02 UTC
Updated:
11 Jan 2009 at 12:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
michelleWhoever told you that was wrong. There is no integration that I'm aware of.
Michelle
Comment #2
Roulion commentedi read it here : http://drupal.org/node/227121
is it planned to be done ?
Comment #3
michelleThere is no astrisk by user relationsips on that page.
Whether it gets added or not is up to Alex.
Michelle
Comment #4
Roulion commentedthat means buddylist2 is not supported as well, i gues?
Comment #5
michelleThe only one that AF comes with code for is buddylist 1 in D5 because I use that on my own site and didn't want to wait for the maintainer to write the code for it.
Michelle
Comment #6
Roulion commentedyou might look at these snippets : http://drupal.org/node/319809#comment-1063747, maybe it's not so hard to add this to the advf-author-pane.tpl file ?
I made a little evolution for drupal 6. It looks like woorking...
it gets an add /remove form into the author pane. However, i don't know how to make a module (i just hardcodded the advf-author-pane.tpl.php file to implement it)
If you might help
Comment #7
michelleI'm not going to add it unless it gets to a point that I need it and Alex refuses to add it. It doesn't matter how hard it is. The code doesn't belong in AF.
Michelle
Comment #8
michelleActually, why don't we just pop this over to his queue and see what he says.
Alex: I haven't written the doc page, yet, for the hook, but it's simple to do. If you're interested in making UR work with AF, I can write the shell code here for you to fill in with the UR code.
Michelle
Comment #9
alex.k commentedSure, let me see what the hook, and expected output, is. Generating links to add/remove relationships isn't very hard.
Comment #10
michelleAt its simplist, it looks like this:
You can put as much code in that function as you need and you can define as many variables as you want. Just let me know what they are so I can document them in the template file. The $variables passed in contains 'account' which is the full user object of the author of the post.
You can either include this function directly in your .module or put it in the file user_relationships.forum.inc and it will be picked up automatically.
For a fuller example, see the buddylist 1 integration.
If you have any questions, let me know. I'll write up some better docs on this and get it in the handbook.
Thanks,
Michelle
Comment #11
alex.k commentedThis is the simplest integration:
Which will print out a bullet list of available add/remove links similarly to Relationship Actions in the user profile. So there is basically a link for each defined relationship type. Do want to show it more minimally, or pop up in a div?
Comment #12
michelleErm... That's way too complicated and way too much text to cram into the author pane.
For reference, here's the variables available for buddylist:
* - $buddylist: Linked icon.
* - $buddylist_link: Linked translated text "Add to buddylist" or "Remove from buddylist".
AF uses the icon by default. If the site admin wants words instead, they change it to use the other variable. That's the sort of thing we need here.
Michelle
Comment #13
alex.k commentedThis is a little better. If there is just one relationship type defined, it'll look just like buddylist, offering an icon and a text link.
If there are several types, each is shown as a text link:
+buddy, +associate, +whatever. See attached screen for what the links are. There are no 'minus' links, since removing relationships is not an often-done task. To make display cleaner, you probably want to style the list items inlineComment #14
michelleFunny, I was just thinking in the shower this morning that I really need to come back to this thread and clarify. I wrote my posts hastily without putting a lot of thought into them and I'm afraid I came off as unappreciative of the work you did, especially since I did say at the start that modules can define whatever variables they want.
And that's true of most modules. The problem is that "buddy" modules are a special case. When you're using standard forum software, you usually just have a little icon to click on to add a user as a buddy. In forum software, you're either a buddy or you're not. That's how buddylist 1 works. This new generation of "buddy" modules has added all sorts of complications. Now, I'm not knocking the features. I'm sure there's tons of people out there wanting this. But they present a problem for forums. If the site has 20 different ways of making someone your buddy, we don't want those all in a list in the author pane of every forum post.
So there's a few routes we could go here:
As you can guess, I'm not terribly fond of #1 but you're the one writing this so if that's what you want to do so be it. #2 isn't a bad option if it's not hard to do from your end. I haven't tried your code, yet, so I don't know what is even on the page the link takes you to. #3 would be my choice but that could be simply because I'm used to the simpleness of buddylist 1 and other users may find that too restrictive. #4 is my ideal fantasy land choice but, as I don't know javascript, is not going to happen unless you have the skills. :)
So what do you think?
Incidentally, I'm going to change the name of the include file in the next alpha. If you're going to put the code right in the .module that doesn't matter to you. If you're going the include file route, you'll want to add it after the alpha. I've been thinking about advanced profile kit and code duplication and I'm going to try and reuse these hooks for AF as much as I can.
Thanks,
Michelle
Comment #15
alex.k commentedNo worries, I'm just as stumped as you are on what the optimal way is. @Roulion can you try the function I attached (paste it at the end of user_relationships_api.module), and pitch in with your usecase?
One argument for the sites that have 20 relationship types is they probably have advanced enough themers to hide unneeded ones via css. To me, an acceptable alternative is augmenting one of AF's configuration forms with a choice of a default relationship to use for this integration. Then, the UI remains a single icon. But, the Ajax popup is the cleanest solution, so I'd lean towards getting it right from the start. Even if it takes longer.
Comment #16
michelleWell, the ajax popup would be awesome but I don't know any js so I'm totally unable to help with that. If that's something you can handle, though, that's great. :)
Michelle
Comment #17
Roulion commentedthanks alex
i test it tonight en tell you...
Comment #18
michelleJust to update, I've written up some docs: http://drupal.org/node/326809
Michelle
Comment #19
Roulion commentedhi
sorry to be newbie but i can't make your code working
if I call this in my advf-author-pane.tpl.ph file
I get this error message :
Fatal error: Cannot use object of type stdClass as array in C:\wamp\www\mysite\sites\all\modules\user_relationships\user_relationships_api\user_relationships_api.module on line 221
What am i supposed to do in the author-pane ? which is the variable of the function i have to call
i tried $author... no error but no links neither, with $account->uid, $user->uid and $author->uid it's the same
i i try this code
<div class="author-pane-icon"><?php print $user_relationships_api; ?></div>i get the same error massage as above
Thank for your help
Comment #20
michelle@Roulion - Sorry, I wasn't clear. I linked to that page for alex. That isn't something you can stick in the .tpl file.
Michelle
Comment #21
michelleUpdating the title since this applies to both modules.
Michelle
Comment #22
Apollo610 commentedHi guys, just wanted to know if you're closer to plugging User Relationships into AF? I just recently decided to implement UR as my "Friends" module, was hoping to be able to plug it into AF soon.
Thanks-
Comment #23
Manamarak commentedAlex, just for the record, I have tried to impliment that code at the end of the file you specified, but it doesn't seem to have any effect. There is no error message, nothing, it is as if I have not added it.
Am I doing something wrong?
Comment #24
michelleOk, I fixed up #13 and committed it to the author pane module. The original idea was to have each module keep its own integration but I gave up after 2 months of trying. Taking care of it myself is just easier. It would be lovely, though, if you could let me know if you change anything that breaks your code in there. It's hard for me to maintain the APIs of everyone else's modules.
At this point I don't intend to support the D5 version of UR unless you are willing to make me a D5 version of that file. UR makes my head swim and I'm only getting paid to do the D6 version. ;)
Thanks for the code,
Michelle
Comment #25
alex.k commentedThanks much, Michelle! Since you're using public API functions, there are no big risks of changes being introduced later on.