EPSCoR / ERCore

ERcore content management system to assist with NSF EPSCoR reporting
4 stars 7 forks source link

Institution name when adding vs. editing a user #25

Open kgolde opened 9 years ago

kgolde commented 9 years ago

When you add a new user, one of the fields to be completed is labeled "Name of Institution". It is a simple text box, and no data checking or validation is done for any text that is entered here. The machine name of the field is field_er_inst_name

When you go to edit that user, you are presented with more options for the Institution, not all of which are readily apparent. When you go to the Institution tab, you are presented with a list of Participating Institutions selectable by radio buttons. You also see a checkbox if the Institution is not listed, and also a text box for the Department.

If you click on the checkbox, there are 5 hidden fields that are revealed. These fields allow you to add a new Institution to the list of available Participating Institutions. The first newly revealed field has the label "Name of Institution". This is the same field that was presented in the interface to add a new user (field_er_inst_name). If you had entered text into this field when adding a new user, it would still appear here, and you could add it as a new Participating Institution.

How can we make for better data entry on the Institution field when adding a new user? Or should we not present the field when adding a new user, and only show it when editing the user?

for more information on the field settings: admin/config/people/accounts/fields

cjallen-epscor commented 9 years ago

@kgolde - I wondered the same thing. I would suggest we make the entity reference field available on the user profile (field_er_inst_ref).

That would definitely assist in adding users.

I added the field field_er_inst_ref on the add user page as shown here http://dev-ercore.nmepscor.net/admin/people/create

What do you all think?

(@kgolde I just added you to the dev server)

iserna commented 9 years ago

@cjallen-epscor and @kgolde

I do not see the use in having the Institution input field. I enter all new participants and have never used it. I did test it on my local install and on dev-ercore.nmepscor.net, it is more confusing than useful and it did not process the institution as expected. I would recommend taking it out of the Add New User screen.

Adding the entity reference field, as @cjallen-epscor suggested, is helpful and it works beautifully. Though, can this be a drop down instead a list, showing only participating institutions? Here in NM we 22 participating institutions which is a long list to display.

Thanks, Isis

cjallen-epscor commented 9 years ago

I have added this feature as a dropdown to dev - http://dev-ercore.nmepscor.net/admin/people/create

Let me know if this is ok with everybody and I can push this commit to core.

khuffman commented 9 years ago

@cjallen-epscor I just tested, worked great for me, thank you.

On 07/10/2015 06:06 PM, Chris Allen wrote:

I have added this feature as a dropdown to dev - http://dev-ercore.nmepscor.net/admin/people/create

Let me know if this is ok with everybody and I can push this commit to core.

— Reply to this email directly or view it on GitHub https://github.com/EPSCoR/ERCore-3.1/issues/25#issuecomment-120539431.

iserna commented 9 years ago

@cjallen-epscor I recommend taking out the Name of Institution text field.

iserna commented 8 years ago

Question for @kgolde, @khuffman, @aturling. Would your Admins prefer to have all the institutions (participating and non) available here or just the participating institutions? In NM we are only showing the participating institutions.

aturling commented 8 years ago

Here we don't use the admin/people/create page; we have the participants create their own accounts on the user/register page. The "name of institution" text box does appear on the registration page, but we told our users to ignore it since they'll select it on the profile edit page later. (To cut down on spam, we use the "honeypot" module on the registration form, and all registrations require admin approval.)

iserna commented 8 years ago

@aturling the "honeypot" module sounds like a good solution to spam. In NM we disable the ability for anyone to "request an account" and spam was a big reason for that. Though, we have never thought of allowing users to request accounts. Sounds like a good alternative to having one person adding users or in some cases having Faculty participants adding users. Thanks for the tip!

kgolde commented 8 years ago

Chris, I like your solution, but can you explain how you did it? I would like to install it on my test site, but I don't know how to implement that. Thanks!

cjallen-epscor commented 8 years ago

@kgolde - sure thing. I went to */admin/config/people/accounts/fields/field_er_inst_ref and click on "Display on user registration form" (the second check box on the form).

I then went to */admin/config/people/accounts/fields/field_er_inst_name and unchecked the "Display on user registration form".

cjallen-epscor commented 8 years ago

I think here at NM we determined that "Institution" prompts need be removed from the user registration page and let them add manually when users log in and update their profiles.

kgolde commented 8 years ago

Here in RI it was desired to place a single radio button selection list for the Insitutions on the add user page. This works correctly for adding a new user. However, when going to edit the user, the institution is not selected. There is a line of code in form_logic.inc that causes this: $form['field_er_inst_ref']['und']['#default_value'] = array_pop($form['field_er_inst_ref']['und']['#default_value']); //fixes the selection This code sets the default institution value which effectively overwrites the institution that had been set by the user. This line should be removed from form_logic.inc

kgolde commented 8 years ago

Another issue that comes up occurs when adding a person to a Collaboration. When you use the User Lookup feature and then press the Auto-fill button to fill the fields, the Institution field is not set to the correct value even if the person has a known institution set in their profile.

kgolde commented 8 years ago

I think I may have found the error. In the function er_form_er_collaborators_node_form_alter in the file form_logic.inc, there is this line: $form_state['input']['field_er_collab_inst_ref']['und'] = array_pop($u->field_er_inst_ref->raw());

The array_pop function expects an array, but the parameter may be a string. A test should be performed before the statement: if (is_array($u->field_er_inst_ref->raw())) { $form_state['input']['field_er_collab_inst_ref']['und'] = array_pop($u->field_er_inst_ref->raw()); } else { $form_state['input']['field_er_collab_inst_ref']['und'] = $u->field_er_inst_ref->raw(); }