I am using User relationships module and created relation friends. Where we can send and receive friend requests just like fb. So l have created view to list all my-friends and also added remove link to the each friend. In view "status link (action)" field is providing remove link which can be used to remove the particular friend from our friend's list, but the link is not accessible to the users other than admin. I want to get relationship id (rid) in view so that I can create remove link. Is there anyone who knows the way to get rid? I just want to create url like below myhomesite.com/user/26/relationships/1115/remove?destination=user/373/friends . where 26 is logged in user id and 1115 is the relationship id.Thanks.

  • Do you want a link that leads to the page where you can delete the account? – Pontus Nilsson Jul 31 '14 at 11:23
  • I have edited My question please have a look on it. – D-pak Jul 31 '14 at 11:45
  • if it is available for Admin, but not available for anyone else as you state in the question, I would look into permissions - there should be an option along the lines of 'manage own friends', or 'delete own friends' – Geoff Jul 31 '14 at 13:32
  • @Geoff I have searched there is no such options available in permissions. – D-pak Aug 1 '14 at 4:52
  • well somehow, somewhere it sounds like a permissions problem based on your question. To test, you could create a new user and role, give them access to everything, and then start taking away permissions until the remove no longer works, then you will know the culprit. Its a first step. – Geoff Aug 1 '14 at 11:38

If you want to output a link in views which leads to the page where the user's account can be deleted you can use the field "User: Cancel link". That field should be present in your view since you have the user as a relationship.

Views user cancel field

If you still want the user's uid and link to some page on your own you need to add the field called "User: uid" and then rewrite the output of the field.

Add the field called User: uid, then under the settings for the field expand Rewrite results and click Rewrite the output of this field, enter the text that should be displayed. Then click output this field as a link and use the [uid] placeholder in the link. The [uid] will be replaced with the user's uid when the View is rendered. You can see an example of the settings in the image below.

Views User:uid rewrite

  • I have edited My question please have a look on it. – D-pak Jul 31 '14 at 11:46
  • @D-pak see the section on "Rewrite the output of this field" in my answer. Just change the link user/[uid]/cancel to the url that removes the particular friend from our friend's list. – Pontus Nilsson Jul 31 '14 at 11:48
  • Yes, for achieving this. relationship id (i.e rid) is needed. And the biggest concern is that there is nothing to get rid in views also with php as well. I have tried for long. – D-pak Jul 31 '14 at 11:56
  • @D-pak could you update your question with the URL you want to create? – Pontus Nilsson Jul 31 '14 at 12:01
  • I have updated my question please check it. – D-pak Jul 31 '14 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.