Skip to main content
Original poster commented that this is for D8
Source Link
sonfd
  • 8.1k
  • 1
  • 20
  • 40

I have a headless Drupal and I'm trying to figure out how to auto assign a role during registration based off of a custom field (field_is_student) in the registration form.

I am trying to use Rules but I don't know how to access the field to check whether it's true or false. My rule is set to "After saving a new user (rules_entity_insert:user)" and the only options I get in the condition Data Selector are are User based.

Here's what I'm using to create my users:

{
    "name": {
        "value": "username"
    },
    "mail": { 
        "value": "[email protected]"
    },
    "field_is_student":{
        "value": false
    }
}

I have a headless Drupal and I'm trying to figure out how to auto assign a role during registration based off of a custom field (field_is_student) in the registration form.

I am trying to use Rules but I don't know how to access the field to check whether it's true or false. My rule is set to "After saving a new user (rules_entity_insert:user)" and the only options I get in the condition Data Selector are are User based.

Here's what I'm using to create my users:

{
    "name": {
        "value": "username"
    },
    "mail": { 
        "value": "[email protected]"
    },
    "field_is_student":{
        "value": false
    }
}

I have a headless Drupal and I'm trying to figure out how to auto assign a role during registration based off of a custom field (field_is_student) in the registration form.

I am trying to use Rules but I don't know how to access the field to check whether it's true or false. My rule is set to "After saving a new user (rules_entity_insert:user)" and the only options I get in the condition Data Selector are User based.

Here's what I'm using to create my users:

{
    "name": {
        "value": "username"
    },
    "mail": { 
        "value": "[email protected]"
    },
    "field_is_student":{
        "value": false
    }
}
Source Link
Brad O
  • 129
  • 1
  • 1
  • 8

Use rules to assign role based off custom field on user registration

I have a headless Drupal and I'm trying to figure out how to auto assign a role during registration based off of a custom field (field_is_student) in the registration form.

I am trying to use Rules but I don't know how to access the field to check whether it's true or false. My rule is set to "After saving a new user (rules_entity_insert:user)" and the only options I get in the condition Data Selector are are User based.

Here's what I'm using to create my users:

{
    "name": {
        "value": "username"
    },
    "mail": { 
        "value": "[email protected]"
    },
    "field_is_student":{
        "value": false
    }
}