I try to load info from FB to user account. But in fields display token. For example, in name's field show - [user:hybridauth:firstName].
My rules:

{ "rules_change_user_info_hybrid_" : {
    "LABEL" : "Change user info (Hybrid)",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "hybridauth", "rules" ],
    "ON" : [ "user_presave" ],
    "IF" : [
      { "hybridauth_user_created_hybridauth" : { "account" : [ "account" ] } },
      { "data_is" : {
          "data" : [ "account-unchanged:field-choose-your-account" ],
          "value" : "1"
        }
      }
    ],
    "DO" : [
      { "data_set" : {
          "data" : [ "account:field-user-first-name" ],
          "value" : "[user:hybridauth:firstName]"
        }
      },
      { "data_set" : {
          "data" : [ "account:field-user-last-name" ],
          "value" : "[user:hybridauth:lastName]"
        }
      },
      { "hybridauth_url_managed_file" : {
          "USING" : {
            "url" : "[user:hybridauth:photoURL]",
            "directory" : "\/sites\/default\/files\/hybridauth-images"
          },
          "PROVIDE" : { "file" : { "image_file" : "Managed file entity" } }
        }
      },
      { "data_set" : {
          "data" : [ "account:field-user-image" ],
          "value" : [ "image-file:owner:field-user-image" ]
        }
      }
    ]
  }
}

Thanks

Comments

duozersk’s picture

Assigned: Unassigned » duozersk
Category: bug » support

Try smth similar to this, it works:

{ "rules_change_user_info_on_creation" : {
    "LABEL" : "Change user info on creation",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "hybridauth", "rules" ],
    "ON" : [ "user_insert" ],
    "IF" : [
      { "hybridauth_user_created_hybridauth" : { "account" : [ "account" ] } }
    ],
    "DO" : [
      { "data_set" : {
          "data" : [ "account:field-user-name-surname" ],
          "value" : "[account:hybridauth:firstName] [account:hybridauth:lastName]"
        }
      },
      { "hybridauth_url_managed_file" : {
          "USING" : { "url" : "[account:hybridauth:photoURL]", "directory" : "hybridauth" },
          "PROVIDE" : { "file" : { "file" : "Managed file entity" } }
        }
      },
      { "data_set" : { "data" : [ "account:field-user-image:file" ], "value" : [ "file" ] } }
    ]
  }
}

Thanks
AndyB

q2_faith’s picture

Status: Active » Closed (fixed)

Thanks a lot)

q2_faith’s picture

Issue summary: View changes

added code tags