i need a condition to check the equivalence of the logged in user vs the user being viewed. is this possible? with rules core? if not, how could i acheive this check to limit my rules actions based on the result of the above condition?

Comments

laurencefass created an issue. See original summary.

Syntapse’s picture

Issue summary: View changes
Syntapse’s picture

Title: rules condition: user is the logged in user? » rules condition: viewed user vs logged in user?
TR’s picture

Status: Active » Fixed

Here's how I would do it:

{ "rules_user_content_viewed" : {
    "LABEL" : "User content viewed",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_i18n" ],
    "ON" : { "user_view" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "account:uid" ], "match" : [ "site:current-user:uid" ] } }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "You\u0027re so vain, you probably think this page is about you - and you\u0027re correct." } }
    ]
  }
}
Syntapse’s picture

what format is this please? is there an equivalent series of steps to access through the UI?

TR’s picture

That's an export of a Rule configured in the UI. To use this on your own site, go to /admin/config/workflow/rules, click the "Import rule" link at the top, then copy #4 and paste into the form there. After you save, the Rule with show up in the UI on your site, it will be working, and you can examine it and modify it.

Syntapse’s picture

thanks for your help.

Status: Fixed » Closed (fixed)

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