Change status link for Views

Kars-T - September 25, 2009 - 13:54
Project:User Relationships
Version:6.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Hi,

for a project we needed a link to change the status of a relationship from a view.
There is a views integration but no column that provides a link. I did add support for this.

Now you can rebuild any page like "/relationships/list" with Views.

AttachmentSize
user_relationships_status_link-D6-1.v1.patch2.55 KB

#1

R.Hendel - September 25, 2009 - 17:03
Status:needs review» needs work

Thanks Karsten,
I tried it and found a mistake in it:
User initiating relationship gets links displayed to "approve" or "disapprove" - instead of this he should get the option to "cancel" his request.
Regards,
Ralf

#2

Kars-T - September 28, 2009 - 13:57
Status:needs work» needs review

New version now with "Accept | Decline", "Remove" and "Cancel" links in a view field in regards to the current loggend in user.

AttachmentSize
status_link-587880-v2.patch 3.04 KB

#3

alex.k - September 29, 2009 - 21:43

Thank you very much, will test it shortly.

One question... this check:

<?php
//Do not show to guests.
?>

Is it better to check for the 'can have relationships' permission? That'll cover registered users who shouldn't be seeing the links as well.

#4

Kars-T - September 30, 2009 - 14:33

Yes checking the access right is much better. Added to the patch.

AttachmentSize
status_link-587880-v3.patch 3.12 KB

#5

DrakeRemory - October 13, 2009 - 11:12

This is an even more correct version. v3 used to always show the cancel link when the logged in user was the requester. Now the correct remove link is shown if the relationship was approved.

AttachmentSize
status_link-587880-v4.patch 3.39 KB

#6

trupal218 - October 18, 2009 - 14:15

Hello,

I patched the newest version of UR module and the patch was successful.
However, I'm getting 'Error: handler for user_relationships > status_link doesn't exist!' when I add the status link field.

Does anyone know what the issue may be?

Thank you!

#7

robby.smith - October 26, 2009 - 17:36

Howdy-

Is there a plan to commit this into main module?

#8

alex.k - November 7, 2009 - 21:48
Status:needs review» fixed

Committed in http://drupal.org/cvs?commit=285604. Thanks!!

@trupal218 use the -dev release once it includes the commit. It should work with the declaration line included.

#9

trupal218 - November 8, 2009 - 04:24

Thank you very much!

#10

robby.smith - November 8, 2009 - 16:04
Status:fixed» active

I tested the newest Dev version which is resulting in the following error:
warning: Invalid argument supplied for foreach() in /home/example/public_html/drupal/sites/all/modules/user_relationships/user_relationships_api/user_relationships_api.module on line 43.

Also, I see that the remove status link in views is loading as ajax popup. Is there a way to choose not for it to be a popup but rather a page for confirming remove/cancel.

User Relationships 6.x-1.x-dev (2009-Nov-08)

#11

Kars-T - November 8, 2009 - 17:25

Hi robby.smith.
Do you think the bug is related to this patch? If yes please set this issue to needs work.

And the second thing seems to me another feature request that maybe should get its own thread? As far as I remember there are globals settings for this and as this patch uses the default API the settings should be apply here as well. So maybe this is a bug report and not a feature request.

No offense but just please keep the issue queue as clear as possible. I was puzzeld by this status change. :)

#12

robby.smith - November 8, 2009 - 22:43
Category:feature request» bug report
Status:active» needs work

ahh yes, that would be a more appropriate status. The error began with an update to the newest Dev version of User Relationships, keeping everything else the same.

Regarding the way the status link behaves, I will open a new thread with a feature request.

#13

trupal218 - November 15, 2009 - 10:02

Hello,

I have tested this several times and also on a fresh install of Drupal and do not see the issue at #10. Anyone else?
Thank you for the great work!

Also, I don't see the feature request in the queue mentioned at @#12 yet and am interested in this feature so will add into the queue now.

#14

robby.smith - November 15, 2009 - 10:42

I'm still not able to get this to work =(

I'm using Views Content Panes in a Panel and the url below shows for the status link 'remove' when users are friends in the view.

http://example.com/user/1/relationships/%2Fremove?destination=myfriendspage

I would appreciate any pointers.

#15

design.er - November 19, 2009 - 14:05

I can confirm - I have the same broken 'remove' link in views: http://example.com/user/1/relationships/%2Fremove?destination=myfriendspage

Help is much appreciated. Thanks a lot for this great feature. :)

#16

trupal218 - November 20, 2009 - 01:42

I have been doing updates and I now see the issue @ #15 and #14 above.

the remove link in views is pointing to url:
http://mysite.com/user/1/relationships/%2Fremove?destination=mysitesfrie...

#17

rburgundy - December 3, 2009 - 06:07

May I kindly ask if any updates on this issue? I did not post but experienced the same issue.

#18

aiquandol - December 5, 2009 - 20:04

The change status link (specifically 'remove') is pointing to an invalid URL. Can someone point me in the right direction to change it myself? This issue seems to have been happening for a while without any resolution. Where is this link being generated in the backend?

#19

aiquandol - December 5, 2009 - 20:11

Okay, for anyone experiencing the issue with the remove links not updating, here's how to fix it.

File: /sites/all/modules/user_relationships/user_relationship_views/views_handler_field_user_relationships_status_link.inc

Line 51: Change $values->rid to $values->user_relationships_rid

You might have to do it on line 37 too.

#20

rburgundy - December 7, 2009 - 02:36
Status:needs work» needs review

If you have time, can the fix be created as a patch?
I will try your explanation above in the mean time.
Thanks

#21

Kars-T - December 7, 2009 - 14:01
Assigned to:Kars-T» Anonymous

I unassign this from me for the moment. I looked at the code but think this would need further testing as I can't say if the one or the other variable name is always correct. Maybe we need an if clause?

#22

alex.k - December 7, 2009 - 14:38

@Kars-T, thanks for looking at this. Did the original code work for you all along? It must have as I do not recall seeing the error either. Does it depend on the view being of type Node, User, or User Relationship (all of which can be made to use this field)?

#23

Kars-T - December 8, 2009 - 12:10

Did the original code work for you all along?

I originally wrote this for one of our projects and did test this on our stage. I don't know how frequently this was used during the beta test of the site but at least there where no new bugs in our issue cue. So yes I believe it did work. :)

#24

rburgundy - December 8, 2009 - 12:57

I get the same error with node view and user view types.

 
 

Drupal is a registered trademark of Dries Buytaert.