Hello all,

I am using rules, OG and UR to run a facebook-style network. People can invite each other to the website and everyone who signs up gets his own private group with his sign-up name. For that I created the following rule:

{ "rules_auto_create_user_group" : {
    "LABEL" : "Auto Create User Group",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_insert" ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "node",
            "param_type" : "private_group",
            "param_title" : "[account:name]",
            "param_author" : [ "account" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      }
    ]
  }
}

Now what I can not gt going is a condition so that you can only add people to your groups if you have formed a two way relationsship in UR (User Relationships) i.e. "Friends".

Something like:

1. Before saving an og membership.
2. Check if two users are related.

And this is where rules become totally unreadable. I can not make heads or tails of any of the options from here on.

Does someone know how to write this?

Thanks,
Paul