I am trying to use condition Check if two users are related and action User account page is viewed on rules. I need to redirect users to another page if users don't have 'Friends' relationships. And have two troubles
1 - If user go to another user profile - drupal throw Notices
Notice: Trying to get property of non-object in user_relationships_rules_condition_users_are_related() (line 211 of /home/sharednu/public_html/sites/all/modules/user_relationships/user_relationships_rules/user_relationships_rules.rules.inc).
Notice: Undefined property: RulesCondition::$uid in user_relationships_rules_condition_users_are_related() (line 211 of /home/sharednu/public_html/sites/all/modules/user_relationships/user_relationships_rules/user_relationships_rules.rules.inc).
Also in $relationship_types variable stored 'execute' string, but as I saw in code, there must be rid of allowable relationships
2 - I need to select, what types of relationships must between users to views profile, but don't know how to set it.
Comment | File | Size | Author |
---|---|---|---|
#8 | user_relationships_rules.rules_.inc_.patch | 1.41 KB | afranioce |
Comments
Comment #1
ohthehugemanatee CreditAttribution: ohthehugemanatee commentedSeconding this. I'm trying to set up to kinds of relationships.
* "Fan" - one way, no confirmation
* "Buddies" - two way, no confirmation
Trying to set up a rule that fires on relationship request. It should check to see if Requestee is a "fan" of Requestor, and then create a "buddy" relationship between them.
But when I "fan" someone, I get
This says to me that the Requestor and Requestee variables which seem to be automatically set in the Rule are not working properly.
Comment #2
ohthehugemanatee CreditAttribution: ohthehugemanatee commentedNote: if I remove the Users are related test, the rule works perfectly.
Comment #3
fehin CreditAttribution: fehin commentedI'm getting this error message too whenever i use the condition.
Comment #4
DrupalDesigner-1 CreditAttribution: DrupalDesigner-1 commented+ 1
Comment #5
DevJoshLopez CreditAttribution: DevJoshLopez commented+ 1
Comment #6
Tritof CreditAttribution: Tritof commented+ 1
Comment #7
de_chris CreditAttribution: de_chris commentedsubscribe
There are also several other issues out there related to profile privacy based on user relationships, e.g. http://drupal.org/node/1774902. Unfortunaltely there is no official solution for this request.
My prefered solution would be to let the user account act as some kind of private database since there are modules (e.g. fboauth) out there which allow to import user data from social media. Furthermore I would like to use profile2 to generate one profile for each kind of user relationship. And for the ease of use I would like to give the user the chance to enable an exchange relation for data between the different profiles. He may also leave field on single profiles blank or enter different information.
Example:
user x can import name and age from facebook to his account
he can then set the relation for the name and age field of his account and the name and age field of his family profile, this profile is only visible to user with family relation
this makes it also necessary to set hierarchic relations between the profiles
advantage: detailed access on how my profile is displayed for each user
disadvantage: complicated and all the stuff related to duplicated content
so for a first version I would be very convenient if I could set restrictions to account fields or profile fields
Comment #8
afranioce CreditAttribution: afranioce commentedI also had the same problem, so I could solve by changing the function user_relationships_rules_condition_users_are_related.
Comment #9
kansaj CreditAttribution: kansaj commentedHi,
Actually I'm not sure if my contribution will suitable, but I found that this rule is a bit of mess or not actually what I was imagining. I though that if two users are related by specific relation/s it should work, but not for me. I modified a bit the code to
Comment #10
scottsawyer@kansaj, your mod seems to work so far as adding the relationship type on the rule, but I have two questions:
I am using UR Invite and have a role I wish to give to a new user based on the relationship type from the inviter. My rule looks like this:
Event:
"After saving new user account"
Condition:
"Check if two users are related"
Action:
"Add user role"
The inviter sends the invite selecting the relationship type. The new user clicks the invite link and registers. In user/uid/relationships, the relationship exists. However, whenever the rule fires, it always fails at the condition.
This is probably more of a Rules question, but I wonder if the relationship does not exist until after the saving of a new user account event fires.
I have also tried to use the Event "A user relationship has been approved", but then the rule never fires. ( this relationship does not need to be approved. ).
Any thoughts or experience is appreciated.
Comment #11
fraweg CreditAttribution: fraweg commentedHi scottsawyer,
did you solve the issue? and if... how?
Best regards
Frank
@ kansaj is this an export of the rule ?
Patch #8 seems to work for me... thanks a lot!