Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields with default values always show on user profiles #8

Closed
aturling opened this issue Mar 11, 2015 · 6 comments
Closed

Fields with default values always show on user profiles #8

aturling opened this issue Mar 11, 2015 · 6 comments

Comments

@aturling
Copy link
Member

I noticed today that fields with default values are displaying on user profiles even if they don't apply to the user. For example, I created a new user from an admin account, entering only the user's first name, last name, and password. Then I logged in as that user and even without touching the "edit" tab on the profile, I see:

[Demographics tab]
Disabilities: None
I am not a veteran.

[EPSCoR Involvement tab]
I am not on the Missouri EPSCoR Executive Team.
I have not completed the RCR training.

[Data Collection tab]
I do not plan to be collecting data through my research.
Data Frequency: One time
I have not been put in touch with the Data Manager.

Also I'm seeing this with existing users. Non-students are seeing "I have not completed the RCR training" because they weren't given the option to select anything other than the default value. Until I removed the default value for "Do you or anyone in your research group receive salary support from EPSCoR?", non-faculty users were seeing "Nobody in my research group receives salary support from EPSCoR" on their profiles.

I have two issues related to this:

  1. I was able to remove default values for all fields other than on/off checkboxes. The on/off checkboxes are the fields remaining (Veteran status, RCR training, data frequency, etc.) I don't know how to specify "no default value" for on/off checkboxes because there doesn't seem to be an option for it. It's confusing users because non-students shouldn't see "I have not completed the RCR training." Also, users who select "I do not plan to be collecting data through my research" shouldn't see "Data Frequency: One time."

  2. I removed default values for other fields, and now these fields don't display for new accounts, but they're still displaying for all accounts created before I removed the default values. Do I need to manually edit the database to fix this?

@cjallen-epscor
Copy link
Contributor

@aturling - thanks for noticing this.
A simple way that I believe resolves this issue is to simply visit *admin/config/people/accounts/display (our dev site http://dev-ercore.nmepscor.net/admin/config/people/accounts/display) and rearrange/hide those fields/tabs to your liking.

You are correct that some fields in this display are unnecessary and should not be shown by default.
It's the tricky on/off issue; especially when we are using "Use field label instead of the "On value" as label" for the value in the field.

I adjusted the user profile tab at the dev site according to @aturling 's suggestions.
Note: I did not modify any default values. Only arrangement of fields visible.

Is this ok? If so, I can simply export the modified user profile tab to 3.1-dev branch.

@khuffman
Copy link
Contributor

Regarding showing confusing info to users: on our site I have noticed
incorrect/confusing results on the "Status" tab as well, for the time
being we just ignore the Status tab because we haven't had time to deal
with it.

Kia

On 03/11/2015 06:53 PM, Chris Allen wrote:

@aturling https://github.com/aturling - thanks for noticing this.
A simple way that I believe resolves this issue is to simply visit
*admin/config/people/accounts/display (our dev site
http://dev-ercore.nmepscor.net/admin/config/people/accounts/display) and
rearrange/hide those fields/tabs to your liking.

You are correct that some fields in this display are unnecessary and
should not be shown by default.
It's the tricky on/off issue; especially when we are using "Use field
label instead of the "On value" as label" for the value in the field.

I adjusted the user profile tab at the dev site according to @aturling
https://github.com/aturling 's suggestions.
Note: I did not modify any default values. Only arrangement of fields
visible.

Is this ok? If so, I can simply export the modified user profile tab to
3.1-dev branch.


Reply to this email directly or view it on GitHub
#8 (comment).

@iserna
Copy link
Contributor

iserna commented Mar 12, 2015

I will bring this up to the Admin group but I think this would be a relevant update to ER Core.

Isis

@aturling
Copy link
Member Author

I ended up hiding the status tab for non-admins by changing the line in er.module under the $items['user/%/status'] array to:
'access arguments' => array(ER_ADMIN_PERMISSION),

@cjallen-epscor
Copy link
Contributor

Thanks all. I committed two things:

  1. the user profile tab edits
  2. the status tab per @aturling suggestion.

Those commits are at the 3.1-dev branch https://github.com/EPSCoR/ERCore-3.0/commits/3.1-dev

@aturling
Copy link
Member Author

I played around with this today and found another fix that doesn't require hiding the fields. It took a couple of steps:

  1. From the /admin/config/people/accounts/fields page, change the widget from "on/off checkbox" to "check boxes/radio buttons" for the fields field_er_rcr_completion_bool and field_er_data_frequency
  2. Still on that page, edit the field_er_rcr_completion_bool and field_er_data_frequency fields to remove default values by selecting "N/A" as the default value for both
  3. Change the code in includes/form_logic.inc that checks whether the user has completed the RCR training to:
    $completed_rcr = array(
    ':input[name="field_er_rcr_completion_bool[und]"]' => array('value' => '1'),
    );
    Step 3 is necessary to make sure the RCR training upload prompts only show for people who select "I have completed the RCR training" (now that the widget type has changed)
  4. (optional?) add this code to includes/form_logic.inc near the above code to remove the "N/A" option from the "have you completed the RCR training?" question since it's just a yes/no thing:
    unset($form['field_er_rcr_completion_bool']['und']['#options']['_none']);
    and similarly, add this near the data collection part to remove "N/A" as an option for data frequency:
    unset($form['field_er_data_frequency']['und']['#options']['_none']);
    (I did steps 3 and 4 in a separate module avoid changing the ER code but same result)

This might be overkill though since hiding the fields does the job, but I'll leave this here in case anyone wants to try it. Also it only works for new users; the fields will show for current users until the database is manually edited to remove the rows from the various tables.

@cjallen-epscor cjallen-epscor added this to the 3.1 milestone Apr 6, 2015
@iserna iserna closed this as completed May 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants