User A adds user B
When B visits user A page, they can add user A again. This showed me some errors in database.

I think the link to add should disappear from action block when the user has added me already.

I'm trying to do an action block on my own. But I can't figure how is the request stated gotten.

I'd like to do this logic:

if ($current_relationships) {
	print 'We're friends. I can remove them';
}
elseif ($USER_REQUESTED_ME_A_RELATIOSHIP) {
	print 'This user had added me. I gotta aprove or disaprove them';
}
elseif ($I_REQUESTED_USER_A_RELATIOSHIP) {
	print 'I added this user. I gotta wait for their aprovement or cancel';
}
else {
	print 'We're not friend. Maybe I can add them';
}

How can I get $USER_REQUESTED_ME_A_RELATIOSHIP and $I_REQUESTED_USER_A_RELATIOSHIP ?

p.s. I'm implementing this from user_relationships-actions_block.tpl.php

Comments

Bilmar’s picture

I am also encountering this same issue.
Any solution to this problem would be greatly appreciated.
Thank you.

alex.k’s picture

Issue tags: +rc2block

I see two issues here:
1. You still see a link to create relationship after one is already created
2. Some help with implementing a custom block (pls read docs of user_relationships_load for hints on this one).

Regarding #1, where is this link displayed? Please post a screenshot. This problem was not reported before.

andrenoronha’s picture

StatusFileSize
new11.9 KB

I attached a screenshot of my block.
The link "add user as friend" should disappear when the user had added me.
Another solution would be: when I click "add user as friend" and the user had added me we would become friends right away.

thanks

Bilmar’s picture

alex.k-

I attached some screenshots as well.
I'm sending the friend request from the my account page of the users.

Thanks.

alex.k’s picture

Assigned: Unassigned » alex.k
StatusFileSize
new37.55 KB
new31.71 KB

Thanks for these screenshots. I can't reproduce this issue, unfortunately (see my screens). Fan is a one-way approval-required relationship. When I make a request in one direction, the other cannot do it.

Are you running unmodified rc1 or latest -dev release? Specifically, there are patches in #348025: Two way of one-way relationship which would make similar behavior.

Bilmar’s picture

Thank you for looking into this issue.
I am currently using 6.x-1.0-rc1 version.

The problem I am having is for the two-way Friend relationship.
User1 goes to User2's my account page and clicks 'Become Friends with User2'
[Friend request is sent to User2]
I login with User2 and go to User1's my account page and click 'Become Friends with User1'
[Friend request is sent to User1]
Then in the pending relationships I see both Sent and Received pending requests.

I hope this clarifies my problem and you are able to replicate it.

Thank you.

alex.k’s picture

I see the problem now, thanks

andrenoronha’s picture

I'm using 6.x-1.0-rc1 version...

alex.k’s picture

Status: Active » Fixed

Committed a fix and test cases to cover this situation, http://drupal.org/cvs?commit=251572. Thanks for reporting!

andrenoronha’s picture

Until now it works beautifully for me. Thanks a lot!!

just a question: what are these test files?

Status: Fixed » Closed (fixed)
Issue tags: -rc2block

Automatically closed -- issue fixed for 2 weeks with no activity.