0

I have a case where users will register with the site from foreign countries. I'd like to be able to let the admin know to update the geocoding settings for the country that they register from.

I'm working with rules, location and User-location, and Gmap. What I have so far is this:

{ "rules_email_admin_update_geocoding_" : {
    "LABEL" : "Email Admin to update Geocoding",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_insert" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "site:current-user" ], "field" : "field_location_opt_out" } },
      { "AND" : [
          { "data_is" : { "data" : [ "site:current-user:field-location-opt-out" ], "value" : "0" } }
        ]
      }
    ],
    "DO" : [
      { "component_rules_send_email_to_admin" : {
          "subject" : "Update Geocoding Configuration ",
          "body" : "A new user [site:current-user] has registered with location information, check to see if the user\u0027s address is outside of the US and if the geocoding settings need to be updated to show the user on the map. Go to admin\/config\/content\/location\/geocoding and see if their country is configure. ",
          "from" : "[email protected]"
        }
      }
    ]
  }
}

This sends an email to the admin when the location-opt-out field is false, that is that the user entered location information. The issue is that I can't drill any further into the location information than the fact that the user hasn't opted out. This works ok for new users, but I will need to have another rule when a registered user updates their address. This leaves me with a problem, because I can't check the actual values in the locations fields.

So, what's the next step? can I access those values with a php snippet, and if so, how?

UPDATE: So, this appears to be an issue with how Rules interacts with the Fields API.Rules Fields

1 Answer 1

0

Install Countries module add field in your registration page. when user register you can value of its location by selecting user country use this value in rules

1
  • Thanks Adi, will this make me add another field? or will this tie in with the user-location field? I would want to avoid redundancy.
    – nizz0k
    Commented Dec 9, 2015 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.