Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module automatically assigns Drupal roles to new users during registration based on their selections in a user form field. It also allows for the display of custom icons next to roles on user profiles, without requiring custom code.

Automatically assign Drupal roles to new users at the point of registration, based on the value they select in a list field on the user registration form. No custom code or Rules configuration required — simply map field values to roles through a clean admin interface and the module handles the rest.

Registration Auto-assign Role Easily (RARE) also provides optional per-role icon display. Upload an image for any role, optionally apply a Drupal image style, and display role icons on user profiles via a pseudo-field in Manage Display — no custom theming required.

Use Cases

  • A membership site that offers "Student", "Professional", and "Organisation" account types — the user picks their type at registration and is automatically placed in the correct role.
  • A community platform that displays a badge icon next to each user's name to indicate their membership tier or specialisation.
  • Any site where role assignment currently requires manual intervention by an administrator after each new registration.

Features

  • Multiple mapping rules. Define as many field-to-role rules as your site needs. Each rule independently maps one list field's allowed values to roles.
  • Any list field type. Works with list_string, list_integer, and list_float field types on the user entity.
  • Role icons. Upload a PNG, JPG, GIF, or SVG icon per role (max 2 MB). Optionally apply any configured Drupal image style and show a visible label beneath the icon.
  • Manage Display integration. Role icons are exposed as a pseudo-field ("Role Icons (RARE)") in the user entity Manage Display screen — enable, reorder, and configure per view mode without any custom code.
  • Proper file management. Uploaded icon files are tracked via Drupal's file usage API. Replacing or removing an icon correctly decrements the usage count so Drupal's file cron can reclaim orphaned files.
  • Cache-aware rendering. Role icon render arrays are tagged with config:rare.settings, ensuring cached user profile pages are invalidated whenever icon configuration changes.
  • Clean uninstall. Uninstalling the module removes all configuration and decrements file usage, leaving no orphaned config or permanently-flagged files.
  • No contributed module dependencies. Requires only Drupal core modules: user, field, image and file. The image module is optional and enables image style support for role icons.

Requirements

  • Drupal 11 or later
  • At least one list_string, list_integer, or list_float field added to the user entity (Configuration > People > Account settings > Manage fields)
  • At least one custom role beyond Anonymous and Authenticated
  • The core image module (optional — required only for image style support on role icons)

Installation

Install as you would any Drupal module. See Installing Drupal Modules for instructions.

After installation, navigate to Configuration > People > RARE Settings to configure role assignment rules and role icons.

Configuration

1. Add a list field to the user entity at Configuration > People > Account settings > Manage fields. Add the allowed values that users will choose from at registration (for example: "student", "professional", "organisation").
2. Go to Configuration > People > RARE Settings.
3. Under Role Assignment Rules, select the list field and map each of its allowed values to a Drupal role.
4. Optionally, under Role Icons, upload an icon image for each role, select an image style, and configure the label.
5. To display role icons on user profiles, go to Configuration > People > Account settings > Manage display and enable the Role Icons (RARE) field for the desired view mode.

Similar Projects

Role Assign
Allows administrators to delegate the ability to assign specific roles to other users during user editing. RARE is different — it targets automatic assignment at the moment of registration based on a field value, with no administrator intervention required.

Registration Role
Assigns a single configured role to all new registrants. RARE is different in that assignment is conditional — different roles are assigned based on what the user selects in a form field, and multiple independent mapping rules can run simultaneously.

Rules
A general-purpose event/condition/action automation framework that can be configured to assign roles on registration. RARE is different in that it requires no contributed module dependencies and no Rules knowledge — the mapping is configured through a single focused admin form.

Supporting this Module

Report Bugs: Help improve stability by reporting issues in the issue queue
Submit Patches: Contribute code improvements and new features
Write Documentation: Share your use cases and configuration tips
Spread the Word: Star the project, write blog posts, or mention it in forums

Community Documentation

A great place to add links to YouTube walkthroughs, external documentation, or a demo site (use DrupalPod!).

Activity

Total releases
1
First release
Mar 2026
Latest release
4 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0 Stable Mar 2, 2026