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?

CommentFileSizeAuthor
#2 user_role_field.patch2.02 KBNexotap
#1 user_role_field.patch2.02 KBNexotap

Comments

Nexotap’s picture

StatusFileSize
new2.02 KB

Sorry 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

Nexotap’s picture

StatusFileSize
new2.02 KB

Added an additional check for the profile2 functionality.
The previous patch may not work when using views.
So here's the new one.

berenddeboer’s picture

Assigned: Unassigned » berenddeboer
Status: Active » Closed (fixed)
berenddeboer’s picture

Issue summary: View changes

Just a minor update in text