Skip to content

Instantly share code, notes, and snippets.

@mrconnerton
Created June 14, 2013 16:13
Show Gist options
  • Save mrconnerton/5783188 to your computer and use it in GitHub Desktop.
Save mrconnerton/5783188 to your computer and use it in GitHub Desktop.
cod create user rule
{ "rules_cod_create_user_registration" : {
"LABEL" : "cod_create_user_registration",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"TAGS" : [ "cod" ],
"REQUIRES" : [ "rules", "commerce", "registration" ],
"ON" : [ "registration_insert" ],
"IF" : [
{ "AND" : [
{ "NOT data_is_empty" : { "data" : [ "registration:anon-mail" ] } },
{ "NOT entity_exists" : {
"type" : "user",
"property" : "mail",
"value" : "[registration:anon-mail]"
}
}
]
}
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "user",
"param_name" : "[registration:field-profile-first] [registration:field-profile-last]",
"param_mail" : [ "registration:anon-mail" ]
},
"PROVIDE" : { "entity_created" : { "new_user" : "New User" } }
}
},
{ "data_set" : { "data" : [ "new-user:status" ], "value" : "1" } },
{ "data_set" : {
"data" : [ "new-user:field-profile-first" ],
"value" : "[registration:field-profile-first]"
}
},
{ "data_set" : {
"data" : [ "new-user:field-profile-last" ],
"value" : "[registration:field-profile-last]"
}
},
{ "entity_save" : { "data" : [ "new-user" ], "immediate" : 1 } }
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment