I’ve been experimenting with Drupal 7 quite a bit and have a doubt with User Roles.
- In the application that I am trying to create, There are 5 roles for users and there is one role ( say E ), which when chosen, the others ( A, B, C, D ) will grey out or can’t be chosen.
In simple terms,
if( $role chosen == A || B || C || D ) { Options to choose other Roles are available including the Role ‘E’ }
if( $role chosen == E ) { Other Roles are blocked and can’t be chosen }
Is there any possible way I can achieve it ?
2 . I also have another doubt about the statuses of the Roles. Can I Flag users in anyway apart from the default ‘Status’ ? Also, if that is not possible, is there anyway for me to create a new Status ?
For the point #1, you can achieve that using jQuery. You can use the code in this answer to get you started.
For point #2, YES you can flag users. You can add your own filter as a field from
admin/config/people/accounts/fieldsand use Field Permissions module to block users from accessing this field.Update:
The steps in details:
1- Go to
http://[YOUR_SITE.COM]/admin/config/people/accounts/fields2- Under to
Add new field, enter the new field name and underType of data to storechooseList (text). Then clickSave3- In
Field settingspage, enter theAllowed values list(Speaker, Attendee, …)4- If Field Permissions module is enabled, you should see
Field visibility and permissionsin the bottom of the page. ChooseCustom permissionsand check the roles that can view/edit this field. Then clickSave settings.Hope this helps… Muhammad.