Hello

There two forms to change the user profile: Account and User Info. In my case most of the fields are duplicated in both forms

Account only fields

User name
Password
Email
Status
Roles

User Info only fields
Picture

Both
Display name
About
Fields that I added

I would like to know if there is a way to customize which fields show in each form or to show only Account with all fields. For what I see it is part of oa_user module. Do I have to make a hook_form_alter() to change this or there is an easier way?

Thanks very much for your constant support :)

Comments

mpotter’s picture

Status: Active » Fixed

That will require custom code, probably in an alter. However, splitting user forms into different profile tabs is a better UX for most people. The Display Name is on the Account page because it's a required field when creating a new user account (where Drupal only shows the Account tab). It is duplicated on the User Info because it's a common thing for people to change as part of their profile (bio, picture, etc).

If you want to add your own fields you should turn on the Open Atrium Profile2 app which uses the Profile2 module to support richer user profiles. Otherwise as you saw Drupal will just dump the extra fields on the Account tab which isn't a good experience.

candelas’s picture

Thanks. I go to try OA Profile2. Thanks

candelas’s picture

I leave this for documentation. To be able to enable oa_profile2

  • Download to sites/all/modules/apps from https://github.com/phase2/oa_profile2 (manually)
  • Download and enable Profile2 module

    drush en profile2 -y
  • enable oa_profile2

    drush apps-install oa_profile2 -y

Since I had to remake all fields that I already made, I thought it would be easier to make a module and set the field access to false and not to use oa_profile2.

/**
 * Implements hook_form_alter().
 */
function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
//I only want to hide fields from the main Account Info 
//if you want to hide files from User Info set $form['#user_category'] === 'user-info'
  if ($form_id === 'user_profile_form') { 
    if ($form['#user_category'] === 'account') { 
        $form['your_field']['#access'] = FALSE;
        //an example in my case
        $form['field_institution']['#access'] = FALSE;
    }
  }
}
mpotter’s picture

That is not the correct method to install. Open Atrium Profile2 is an APP. That means you just go to admin/apps, click on Open Atrium Apps, find it in the External Apps tab and click it and install it.

You should *not* try to install apps manually like stated in #3 as it won't necessarily download or apply any needed patches, etc. In the case of Profile2 it's pretty simple and happens to work, but in the case of other more complex Apps it will not work.

So please use the Apps UI for installing Apps.

Glad you were able to get it working though.

candelas’s picture

@mpotter thanks for your time. You are very patient with all of us asking and making mistakes :) I really appreciate a lot your explanations. I have never been in a distribution or module that answered so fast and well.

In admin/apps/openatrium , i go to admin/apps/openatrium/oa_profile2/details when I try to enable it ask for ftp and I don't have ftp in local or in the server. So I can't use that way to install. So I try with drush.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

surendramohan’s picture

@candelas:
Did you get a chance to fix this?

I am also facing the same issue. It would be appreciated if you could provide the solution you applied.

Additional information about my scenario:
We already have the set of user fields in place, and 1000+ users already signup and using the portal.

Meanwhile, I shall try overriding the feature referring the code snippets you shared at Comment #3.

surendramohan’s picture

@candelas:
The code snippet at Comment #3 worked for me :)

Thanks again!

imorale2’s picture

So basically am I always going to end up with three tabs? "Account", "User Info" and "X Profile from OA Profile2" ? How can I replace the "User Info" one for the "X Profile from OA Profile2" ? Or add just fields to the "User Info" one? ...

It seems an odd behavior ... am I missing something? I've been struggling with this. Can someone help?