Hello,
Since I desperately need the feature to restrict profile fields by role, I just coded it myself. I used user_readonly as the basis, but I think I changed too much to be considered a patch :p so attached is my hack.
Besides the feature I mentioned (restrict fields by role), other changes are:
* configurations are now per-field basis. I wanted to make it role-based, but it is too complex (imagine a user having 2 roles that have restriction rules that conflict each other). This makes the settings page very fat however.
* change of [b] tags to [strong] - for XHTML. Also removed [br] (not my style - see how this is becoming personal...)
* options now apply for all fields appearing in user/xx/edit, not just predefined ones (the list is retrieved runtime with drupal_retrieve_form())
* can now delete (hide) fields instead of disabling it, except for passwords and dates
* added 'reset to defaults' for settings page (copied from Drupal core)
* added docs/ help string appropriately
It's ok if you don't want to take my code, as there are too many changes. I just hope that it helps. Thanks for the codebase by the way!
| Comment | File | Size | Author |
|---|---|---|---|
| user_readonly.txt | 8.18 KB | Leonth |
Comments
Comment #1
Cainan commentedI like the changes i see in your mods. (especially the use of drupal_retreive_form)
I am also looking to add OG support to this module.
Thanks!
Comment #2
cbutera commentedI like your improvements - but I'm getting the following error message when I click on the settings page - admin/settings/user_readonly:
warning: Invalid argument supplied for foreach() in /home/drupal-5.1/sites/all/modules/user_readonly/user_readonly.module on line 71.
Comment #3
Libra commentedChange line 70 from:
if ($k[0] != '_' && !element_property($k))to
if ($k[0] != '_' && !element_property($k) && is_array($v))Comment #4
jowan commentedyes, this is pefect for what i need and works a treat.
but
is there any way to remove / hide a user profile categorie's tab in the user/edit page if all of its fields are empty disbled in the userreadonly admin panel?
I have a category called 'personal' and in it there are two fields called 'age' and 'sex', if i set the fields to be deleted for the a role in the adminpage, i can still see the category tab 'personal' in the user/edit page, which when selected is obviously empty, thanks to this mod.
If i can just get the category tab to disapear int the user/edit page it would be complete
jo
Comment #5
deekayen commentedThank you all for your work on this. It's been long, but I hope you'll still contribute your forks in the future. One notable thing I changed was removing the check for blanket administer users permission check since now individual roles can be set on separate fields.
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.