I would like to create a rule: 'when user updates account, if theme property has changed..."

This will also be useful property for Theme Rules.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexweber’s picture

Status: Active » Needs review
FileSize
1.03 KB

Patch attached.

mitchell’s picture

Status: Needs review » Needs work

Patch applies cleanly and the property is available, but Rules doesn't behave as expected.

With this rule:

{ "rules_echo_theme" : {
    "LABEL" : "echo theme",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_view" ],
    "DO" : [ { "drupal_message" : { "message" : [ "account:theme" ] } } ]
  }
}

I get an error: "Notice: Undefined index: custom translation language in RulesDataUI::selectionForm() (line 73 of sites/all/modules/rules/ui/ui.data.inc)", and the theme name doesn't appear in the system message. With [account:name], the message is displayed properly.

alexweber’s picture

I overlooked this, Views integration might be broken too now that I think of it...
Reroll tonight when i get a chance!

alexweber’s picture

Status: Needs work » Needs review
FileSize
1.15 KB

Nothing was being displayed because in most cases the user's default theme is actually empty, and falls back to the site's default theme.

I've updated the patch to reflect that.

fago’s picture

Status: Needs review » Fixed

thanks, the default value for the theme_default (bartik) was missing. I've added + removed the unnecessary translatable key + committed it.

alexweber’s picture

Awesome!

mitchell’s picture

thx fago! thx alexweber!

While testing the patch, I realized... this solves #1344348: Port Theme Rules to D7 too!!
...Entity API + Rules... what an amazing combination!

Status: Fixed » Closed (fixed)

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