Upload users via csv and allow them edit and fill profile once

Upload users via csv and allow them edit and fill profile once

by ارسطو رامش -
Number of replies: 10

i will be setting up a number of user accounts for a training centre each upload. The username is going to be an ID number ( username  and password) but i won't necessarily know the first name, last name and email of each user at upload time. So i was going to add a default e.g. Student1, etc to the csv file to enable upload to function ok. We'd like that the user can change these fields when they first login but after that it is locked.

i cant find an answer for these 2 problems:

1- how i can make an acceptable csv file that contain only  username and  password instead of fill  other 3  fileld  ( firstname , lastname, and email ) with junk data to enable upload csv file ?

2-  it is very very important  that users must fill out all other field( firstname , lastname, and email) as soon as login  for first time and then loced  .


any one can help me ? plzzzz  its very  necessary

Thanks in advance for any help and your time.


Average of ratings: -
In reply to ارسطو رامش

Re: Upload users via csv and allow them edit and fill profile once

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It strikes me that if you don't know their details then there's little point creating their accounts. It's really very little different from using email based authentication. 

To be honest, I would make the effort to find out the full details of users before loading them into Moodle. It will save you a great deal of pain. 

In reply to Howard Miller

Re: Upload users via csv and allow them edit and fill profile once

by ارسطو رامش -

thanks very much for  reply;

but i must do that  . please help me if possible , i really really need to know . im working on  another lms and i must give usernames and passwords  provided before for my unknown  students via my web site!

please guide me .how can i  make change to default registration form so that accept  empty field for  firstname  and lastname  via upload csv (remove requirements) ? and then  its very necessary to force student fill out empty field in first login.

or

if its not possible ican  add a default e.g. Student1, etc to the csv file to enable upload to function ok,  i'd like that the user can change these fields when they first login but after that it is locked.


thanks for yor time.

In reply to ارسطو رامش

Re: Upload users via csv and allow them edit and fill profile once

by ارسطو رامش -

i search and find this  solution but i dont now how to do this? and im not sure exactly worked or not.

In user/edit_form.php I added the option to have the field as unlocked if empty or 'changeme':

} else if ($authplugin->config->{$configvariable} === 'unlockedifempty' and $user->$field != '' and $user->$field != 'changeme') {
$mform->hardFreeze($field);
$mform->setConstant($field, $user->$field);
}

Now if I make any of the relevant fields 'Unlocked if empty' and use 'changeme' as the default in the csv file for import, this does what I want and allows the user to edit the profile fields once on startup.

 anyone can help me how to do this change? and if can  solve my problem?


In reply to ارسطو رامش

Re: Upload users via csv and allow them edit and fill profile once

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You should be able to edit the csv php file so that your firstname, lastname and email are not required fields.  Look at the files in admin/tools/userupload

Average of ratings: Useful (1)
In reply to Emma Richardson

Re: Upload users via csv and allow them edit and fill profile once

by ارسطو رامش -

thank you emma;Yes

is it possible explaine more? which file(s) i have to edit? plzzzz

im new in moodle and programming (php) . with this action any chance that i solve my problem?

merci , with best wishes for you

In reply to ارسطو رامش

Re: Upload users via csv and allow them edit and fill profile once

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I don't have time to search through them for you unfortunately.  You are looking for required fields...

In reply to Emma Richardson

Re: Upload users via csv and allow them edit and fill profile once

by Doug Moody -

Emma,


Do you know if it is possible to also make username as not required? I can identify my users based on firstname and key on that, but there is a technical reason why I cannot identify based on the username.

If this is possible, then you are my new sweetheart smile

Thanks.

In reply to Doug Moody

Re: Upload users via csv and allow them edit and fill profile once

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I doubt it as the Moodle username is the main identifier (unless you could somehow use the idnumber for that - beyond my expertise) - could you not just make the first name the username?  Must be a very small Moodle!!

Sorry, guess you will need to find another sweetheart!

 

In reply to Emma Richardson

Re: Upload users via csv and allow them edit and fill profile once

by RTR Admin -

Moodle requires at least five pieces of information to create a user profile. You cannot create a profile without filling in all of the required information. If you don't know the students name you can use generic filler text like, student 1, just make sure to click the option that requires them to change their passwords during their first session. When they change their password you can include a note to change their other information as well. It takes a bit of advanced configuration but watching this video should help.