I'm going to be moving away from User Relationships on my own site. Nothing against UR; it's a fine module. I just decided I want to move to a more Twitter like "follow" module rather than friending and am going to do it using Flag.
I'm trying to cut down on supporting modules I don't use, so I'm asking to pull the Author Pane integration into UR. The AP specific code is very simple and low maintenance with the heavy lifting being in the UR specific code so it wouldn't be much work on your end. I have one last change I need to finalize with regards to allowing site admins to selectively turn off integrations but, after that, the code will be pretty stable.
Michelle
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | ur_author_pane.patch | 662 bytes | jcmarco |
Comments
Comment #1
michelleForgot something. This issue needs sorting, and that will be in the UR specific code as well: #738226: Ensure all possible user relationships are covered
Michelle
Comment #2
freelylw commentedseems UR can do the one way following as well. still thinking UR or Flagfriend
Comment #3
michelleHere is the last version of the integration. I've pulled it from Author Pane. It works somewhat but has some issues as seen in #738226: Ensure all possible user relationships are covered. If you look at the code, you can see that 99% of it deals with UR code and there is very little to do for the AP integration. Given that, and given that I am moving away from UR, I just can't support it anymore and don't want a broken integration in the 2.0 release.
If you need any help with the AP side of things to add the integration to UR, I'd be happy to help.
Michelle
Comment #4
jcmarco commentedPatch to fix last version with Author Pane 2.0
Comment #5
bennos commentedthx jcmarco
Comment #6
michelleHmm... I don't see what this patch is doing?
Anyway, as far as I know, the code works aside from that issue I linked to.
Michelle
Comment #7
jcmarco commentedBecause with the existing nested if's,
the $variables['user_relationships_api'] was not defined and then not shown in the author pane template.
Comment #8
michelleOh, I was just looking at the actual text and didn't notice the indentation. Weird... I'm still using UR on my site at this point and it's working fine for me.
Michelle
Comment #9
michelleIn an attempt to move this along, here is the function with all the AP stuff in it. What's needed is for someone to fill in the "meat" of the function with the UR code that covers all the crazy possibilities of who can have relations with whom.
Comment #10
michelleSorry to keep posting on here but I want to have this resolved before I release AP 2.0 so keep thinking about this.
I think part of the problem is that UR is very complex and isn't easily reduced to a simple "add friend" in all cases. So how about if it gets a new API function that does this:
Doing this would encapsulate all the logic into a UR API function and keep the integration clean. I would still prefer to have the integration in UR but would be willing to pull it back into AP if needed if all the UR logic was a simple function call. It would also cover all the possible relationship types and put them in a single variable that's easy to add to the template. By having both the add/remove class and the relationship class, the theme could target each type and give it a different icon if wanted. AP would continue to provide the generic icon based on add/remove.
What do you think?
Michelle
Comment #11
dmetzcher commentedAre there any updates from the UR maintainer(s)?
Will support for Author Pane be added to User Relationships? :)
Comment #12
michelleHe emailed and said he'd look at it but it sounds like he's very busy so I don't know when he'll get to it.
Michelle
Comment #13
dmetzcher commentedThanks, Michelle.
For now I've gone with displaying the UR Actions block in a pane on my profile pages. I added a little styling and it actually sort of looks like what you had going on in Author Pane (although I've moved it to just under the profile page's title text).
Note for the maintainer: If this is implemented... could we get a setting (even a submodule that we could deactivate would be fine) so that we can choose to not display the UR actions in the Author Pane? An interesting idea would be to allow us to turn it on and off for Advanced Profile Kit (Author Pane on profiles) and Advanced Forum (Author Pane on forums), but I know that's probably a lot more work for you, so whatever is simplest will work just fine, I think. :)
Comment #14
alex.k commentedI committed initial integration in http://drupal.org/cvs?commit=437224
It uses the CSS classes you suggested, as well as settings to turn on/off the entire feature (see in admin/user/relationships/settings) and pick which relationship type to use for the link.
I have a question, though. AP seems to require that only one element is passed into $variables[...]. This means that UR needs to output just one link, or an HTML list of several. It would have been better if AP would array_merge the individual $variables so that the list looks uniform, yet modules can return more than one link. What do you think?
In the meantime UR has a control to pick which relationship type will be used in AP.
Comment #15
michelleThanks for committing this. :)
You can put whatever you want into $variables. I suggest using 1 variable to keep it simple for end users. Whatever you put in there comes out as a variable in the template. It's a lot easier for someone who may not know PHP to just have one variable per module. If you want to change things, though, just let me know and I'll update the template with the changes.
Michelle
Comment #16
alex.k commentedThanks for the hint, corrected this now to allow picking more than one relationship type, if desired. Hope this works :)
http://drupal.org/cvs?commit=437362
Comment #17
michelleThanks, Alex. I'm totally focused on Advanced Forum at the moment but will be turning my attention back to Author Pane soon as I get AF alpha 4 out. If I find anything that's not working I'll let you know.
Michelle
Comment #18
ukrdrupal commented...subscribing
Comment #19
stg11 commented...subscribing
Comment #21
michelleSorry to have to revisit this but it turns out this isn't fixed. When I tested, I missed deleting the .inc from my copy of AP and it turns out it was using that instead of this version. I just discovered that today while trying to fix another issue.
1) The file is named wrong. It should be user_relationships_api.author-pane.inc. This is why I never noticed I was testing the wrong code... It never found your code.
2) The changes to the code itself aren't working. Comparing what's in there now to what used to be in there, it looks like there's a bunch of changes. I don't know enough about UR to be able to tell what's wrong but I narrowed down the problem area to this:
$rtids is array(0 => 0)
$all_rtypes is array(1 => $object) where $object is the relationship.
So $all_rtypes[$rtid]; isn't finding anything because there is no 0 key in that array.
Thanks,
Michelle
Comment #22
michelleOh! I just had a lightbulb moment with #2. I looked at the variable and realized it said "author pane" in it which meant there must be some AP related setting. Doh! Reading back, I see you said that and I totally missed it. Ok, so forget #2. That's just a matter of going into the setting page and setting it. #1 is still needing fixing, though.
Michelle
Comment #23
alex.k commentedFixed http://drupal.org/cvs?commit=459510 please try it out.
Comment #24
michelleLooks like it should work fine; all I did was change the filename on my copy to fix it in testing. I'll grab a new tarball tonight when it's generated and do a fresh install to be sure. Thanks!
Michelle
Comment #25
alex.k commentedAnd http://drupal.org/cvs?commit=459512 to remove manual load of the .inc file from user_relationships_api.module. That's why it worked for me despite being incorrectly named.
Comment #26
michelleHuh... Weird. If there's a manual include in there, I wonder why I didn't get an error about the redefined function? At any rate, yeah, you don't need it. AP handles loading the file for you. Trying to make it real simple for module maintainers. :)
Michelle
Comment #27
webchickThis mis-named file caused rc6 to completely white screen of death on any forum node on our site.
It might be good to get another rc out when it's prudent. That's an hour of my life I'll never get back. :D
Comment #28
sandino commentedI have UR link if I'm already in relationship with a user (e.g. link to remove a friend). But the link is not shown if I'm not in relaitonship (e.g. to add a friend).
After updating on new version of UR the problem still exists.
Comment #29
gallamine commentedI have the same problem that Sandino has. I running Author Pane 2, the latest version of Advance Profile Kit and the latest (as of today), dev. copy of UR. I can only see the "remove" link, not the "add" link.
Comment #30
paul555 commentedI also have the same problem with sandino and gallamine
Comment #31
DrupalCuckoo commentedhi,
I've read this this issue and I've a question:
Since I've updated to Author Pane 6.x-2.0, the "add user as friend" link on a profile page is no longer showing up. I've also updated the User Relationships Module to the latest version 6.x-1.0. In the UR module directory there's a file called "user_relationships_api.author-pane.inc" which - I think - should provide the missing link.
In the author_pane.tpl.php file there's the variable "$user_relationships_api_link" and when I print it, it's empty.
How can I make this work again?
Thanks for any help!
DrupalCuckoo
Comment #32
michelleTry this version: http://drupal.org/node/500960 . I can't remember if the changes to the template file made it in before 2.0. I'll be making a 2.1 release once Advanced Forum Alpha 4 is released.
Michelle
Comment #33
oduvanchik commentedMichelle,
I tried to update author pane, and updated user relationships. It is not showing up. IS there anything else I can do?
Comment #34
HamsterTrainer commentedthe newest versions dont work together :(
Comment #35
junro commentedHello, just figure user relationship link doesn't not appear in author pane anymore.
Even If I check "Show links in Author Pane" in admin/user/relationships/settings, and select my relationship to use.
I can't tell after what event the link has dissappear. After the update of UR module? I think so, logical, but not sure.
Comment #36
junro commentedI'm using:
Author Pane 6.x-2.0
User Relationships 6.x-1.0
Comment #37
HamsterTrainer commentedit works withe the newest versions of UR and AP
i see the AP integration is now in UR --> settings
Comment #38
junro commentedCan you give me your versions? dev version? new 1.0 version?
I'm using the last recommanded version.
Comment #39
michelleThis integration is working fine. You may need to use the development version of AP until there's a new release. Make sure you've set up the integration in the UR settings.
Michelle
Comment #40
HamsterTrainer commentedmy versions...
Author Pane 6.x-2.0
UR 6.x-1.0
Comment #41
rkarajgi commentedI am using
user_relationships-6.x-1.0
author_pane-6.x-2.x-dev (as of today)
I enabled the Integration in UR settings and selected the Friends, as the relationship.
I cleared all caches.
I was expecting to see the links for Add as Friends in Author pane.
But still dont get the links. Is this integration working?
In the AP 2.x-dev, in the modules folder, there is no user_relationships*.author-pane.inc file present.
Comment #42
rkarajgi commentedIt works - I was using Advanced Profile Kit and I had made another copy of the author-pane.tpl.php as the advanced_profile_author_pane.tpl.php. I copied the new author-pane.tpl.php file to themes folder as advanced_profile_author_pane.tpl.php and it works as expected.
Thanks for this Author Pane and User Relationships integration. It sure makes life much easier now !
Comment #43
AntiNSA commentedI absolutely can not see the add friend link with newest devs of both versions... I need this to work.
Comment #44
AntiNSA commentedok sorry I had to select the friend type to add..
Comment #45
michelleI don't even know why this is active. This has been implemented for some time.
Michelle
Comment #47
venusrising commentedWe are running RC6 but did not want to start a new duplicate thread. Don't know how we missed this but we too have the issue with the missing add friend link in authorpane. All user relationship configurations are ticked and I see the code in AP but no sign of the link.
Any input from anyone would be terrific.
Thanks
Comment #48
venusrising commentedI have the same issue as gallamine & Sandino
Comment #49
venusrising commentedOkay for anyone having trouble
We had an old type of friend. I opened it up and made sure that the settings were not blank (which would mean ALL users could have the type but it was not working this way) I made sure that for
Role request access
Role receive access
These were set and not left blank.
Prior of course we went in to the new UR admin and selected Authorpane. After hunting for hrs it was the lack of the Role settings being blank causing the issue for us. Hope this helps someone.