As I can see, this only works for fields in user account.
Why is it not possible to use it on all fields?
Or at least for fields defined in a profile2 page?
This could be implemented as a configuration option.
The following function I've changed from:
function user_role_field_form_alter(&$form, $form_state, $form_id) {
if (isset($form['instance']) && $form['instance']['entity_type']['#value'] == 'user' && $form_id == 'field_ui_field_edit_form' && isset($form['field'])) {
module_load_include('inc', 'user_role_field', 'user_role_field.admin');
return _user_role_field_field_settings_form_alter($form, $form_state, $form_id);
}
}
To:
function user_role_field_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'field_ui_field_edit_form' && isset($form['field'])) {
module_load_include('inc', 'user_role_field', 'user_role_field.admin');
return _user_role_field_field_settings_form_alter($form, $form_state, $form_id);
}
}
Also, there is need of altering the user_role_field_field_access function.
This is not a working solution, just some ideas.
What Do you think?
Comments
Comment #1
Nexotap commentedSorry for bothering again.
Just made a working version, which only integrates profile2.
I think, this would make sense.
Feel free to try the patch.
Cheers
~Nexo
Comment #2
Nexotap commentedAdded an additional check for the profile2 functionality.
The previous patch may not work when using views.
So here's the new one.
Comment #3
berenddeboer commentedComment #3.0
berenddeboer commentedJust a minor update in text