Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
Role Expire is a simple module that allows administrators to set and control expiry dates of user roles. A common use case for this module is to implement magazine style subscriptions where somebody purchases or receives access for a fixed period of time.
At the moment it implements the following functionality:
- Selecting a role (or roles) on user_profile_form triggers a textfield (or textfields) where admins can enter expiry date for selected items.
- Defined expiry dates are displayed on user's profile (visible only for owners of the profile or users with proper permissions). This can be altered using standard theme_ or hook_user() functions.
- Role expiry dates are controlled by Cron, so it automatically removes any expired roles.
- Simple API is provided to set, clear or retrieve expiry dates for given roles and users.
- Views module handlers are provided for displaying, sorting and filtering expiry dates inside views (per role).
- Set default expiry duration (12 hours, 1 day, 3 days, 4 weeks, 3 months, 1 year) for each role in the edit role screen, so that on receiving a role a user will keep it for the stored time span. The expiry duration can be a strtotime-compatible string (like "last day of this month"). Handy for Subscriptions or temporary access.
- Migrate module support for migrating roles into your Drupal site.
- If you want to keep role history alongside look at role watchdog module
- Rules module integration
- Support for Role Delegation module.
- Support for RoleAssign modules.
- You can set a default role when each role expires.
- End sessions when expiring roles
- Provide an option to disable RE for selected roles [not available on D7]
Branches
- Branch 4.x: Drupal 11 compatible. Using Rules version 4.0.0 or greater is recommended if you use the Rules integration that is now under "Role Expire Rules" submodule.
- Branch 3.x: Drupal 10 compatible. Requires a Rules version 8.x-3.0-alpha8 or greater if you use the Rules integration. No further development.
- Branch 2.x: Drupal 8 and 9 compatible. Requires a Rules version 8.x-3.0-alpha7 or lower if you use the Rules integration. No further development.
Supporting organizations:
ported Drupal 7 version to Drupal 8, 9, 10 and 11, maintains Drupal 7 version
Project information
- Module categories: Access control, Administration tools, Developer tools
- 3,518 sites report using this module
- Created by bdziewierz on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.