Importing Parents to Moodle

Importing Parents to Moodle

by Natalie Jordan -
Number of replies: 69
Does anybody know if there is or is ever likely to be a way to import parent details to link with pupil details.

I can see this being a very useful feature but also a very tedious feature to enable, if each pupil needs to have the parent added manually.
Average of ratings: -
In reply to Natalie Jordan

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I was looking at a way of doing this via phpmyadmin and directly adding the records to the database. It has been a while since I looked at this but it would avoid the manual process that you mentioned. Let me know if you would like more information and I will see if I can find what I had learned from my previous experimenting prior to the release of 1.8. Peace.
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Alick Brown -
I would be very interested in some more information on this. I have been experimenting with using Moodle in my own subject area but would like to see it extended to a school-wide basis.
Manual linking seems much too cumbersome. Could there be some way to connect the allocation of parent roles to a database [we have a database that contains parent info for each student] - or would it need periodic exporting of that info to a flat file?
In fact is linking to a database something I should be thinking about to keep student records up to date?
[I have uploaded pupil course allocations with a csv file, and use LDAP authentication - which we would want to keep]
Many thanks,
Alick
In reply to Alick Brown

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Alick - How are you planning on creating parent accounts? There are a couple of options that come to mind. The first is to use your Student Information System (SIS) to generate a list of parents and some type of linking information to the student. Another would be to create a parent account for each student. For example StudentId_Parent. How you opt to handle the student records depends on how much change you actually experience. We will be looking at the possibility of creating parent accounts so I appreciate you help in thinking this through. Ultimately, what I would recommend is that once you determine how you are going to handle to parent accounts go ahead and create them and then just add a role via sql for all the parents. Continue to feed me more information and we will get down to more specific instructions. Seeing how you do this and think through this process will be helpful to me as I prepare for similar conversations with our administrators. Peace - Anthony
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Alick Brown -
Hello, Anthony
Sorry - I missed your reply.
I'm not sure I can be as clear as you would like - here goes:

We keep our records on a Filemaker database - actually I guess it's several related databases. Now I can use the database, but I've no idea how it is set up or how to make it communicate with Moodle.
As far as producing parent accounts from the database is concerned , I guess that data is not going to change much - we could do a termly complete update with manual editing in between.
However, I have only been trialling Moodle within two Departments. I have been enrolling students using a flat file taken from the database. I'd like to extend it across the school [we have 1000+ students] - this is where we would need to keep course enrollment data more up-to-date so that student course membership data could be read from the database - this data is going to be more volatile than parent data.

I don't know if this makes sense?

Thanks
Alick
In reply to Alick Brown

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Alick - My apologies for the long delay. End of year, annual retreat, summer duties, conferences, and soon to be packing, etc., etc. In any case, I will take a look at what needs to be done and see if I can give you plan of attack tomorrow. Peace - Anthony
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Justin P -
I am currently trying to accomplish this same task. My situation is that I've already created a column in the mdl_user table for holding the name of the parent which is populated using ldap.

My idea was to create a script that would run each night like cron to populate the mdl_role_assignments table with the correct roles. The problem with my idea is that the contextid that is taken from the mdl_context table confuses me.
In reply to Justin P

Re: Importing Parents to Moodle

by Bob Eadie -

I'm trying to do similar things (but not sure I'm up to "creating extra columns in tables" to do what I want).

We import student data (and course enrolment) from flat files, generated from our database by fairly simple queries.

We could easily do the same for parents, but then how to link each parent with pupils.  Again, the info is in the database, so could be generated OK, if Moodle could then import it.

My main problem at the moment that I cannot even overcome manually, is how to allow each parent to SEE each course that their child is enrolled on, without enrolling the parent too . . .any thoughts?

Bob Eadie

In reply to Bob Eadie

Re: Importing Parents to Moodle

by Brad Felix -
Hi Bob,

I'm interested in the same thing - do not want to face the task of doing this manually. Although it might be bearable if there were a slick AJAX-ish user manager which could handle tasks such as enrolling a user in multiple classes at once. The file uploader is too advanced for our registrar.

Let us know if you come up with a solution.

Brad



In reply to Brad Felix

Re: Importing Parents to Moodle

by michael nolast -
When the people in this post are talking about "parents",are you referring to the parent role/mentees block functionality? And then simply importing a list of students/parents in order to set up the relationships?

I imagine a column for "parent username" could be added to the upload users script, and then the script could be altered to map students to parents based on username. Is this what everyone is looking for?
In reply to michael nolast

Re: Importing Parents to Moodle

by Bob Eadie -

Yes - in my case - broadly.  That is I am interested in parents (fathers/mothers/guardians) of pupils/students being registered so that they could see the COURSES on which their children were enrolled.

Unfortunately, it is a many to many relationship, in that (when some families are split) one child can relate to several parents, and one parent can relate to several children/students.

I think our MIS database can hadle all of this, BUT I just cannot find out how to enable a mentor to VIEW the courses of his/her mentees.

Bob

In reply to michael nolast

Re: Importing Parents to Moodle

by Jalil K -

Has anyone managed to get this to work (either via PhpMyAdmin or CSV upload files?).

I've got a list of parents I would like to import, with child username in the list. Apart from populating the mdl_user and mdl_role_assignment database, what other tables do I need to populate to create the link from child to parent?

I was thinking of attempting this with phpMyAdmin if it was at all possible.....look forward to any responses?

In reply to Jalil K

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I've not done it but I did look into doing it. AFAIK, if the users are added and the role assignment is given it should work. Let me know if you have any questions about the SQL needed to do so . If you do one manually you can get an idea of what the result should look like in the role assignments table.

Typically what I have done is I import the list of parents (or whatever other data I'm working with) into the MySQL database and then use phpMyAdmin queries from there. Of course I typically run these on production data on a test server first (OK, ideally I do that). I'd say give it a shot and see what happens. Peace - Anthony
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Jalil K -

Thank Anthony,

I wouldn't mind having a little bit of help with the SQL if you're upto it. Yes I am also using a local test server... before I put this code in a production environment.

I've got my parents uploaded, but what I can't seem to suss out is how I can relate my parents to the children. the fields in mdl_role_assignments look fine(understandable) apart from contextid....not sure what that means

Many Thanks

In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Justin P -
Hey Anthony,

I would also like some help on the sql to achieve these manual configuration of role assignments. The context field confuses me :P. Could you maybe give some generic scripts that achieve this?

When you import the parents how do you initially associate them with the students? I thought that adding a parent column to the mdl_user table would be a good way to handle this but if you have a better way, it would help me out greatly.
Thanks a lot!
In reply to Jalil K

Re: Importing Parents to Moodle

by John Isner -
The enhancement suggested in MDL-15187 would address this problem (unfortunately, the title of the issue is misleading and you have to read the forum discussion it refers to).

The idea of MDL-15187 is to extend admin/uploaduser.php to be able to assign any role in any context (currently, it only assigns roles in course contexts; you specify the course using the course shortname). Any context can be specified by two numbers: the context type and the context instance. The User context type is 30. So, for example, my user context on moodle.org is (30,104240).

With this change, the administrator could create a csv file with a row for each parent. For example, if my parent is Ebeneezer Isner...

username,lastname,firstname,context,role
...
ebi999,Isner,Ebeneezer,(30,104240),parent
...
In reply to John Isner

Re: Importing Parents to Moodle

by Ger Tielemans -

John, may I ask you something about roles.

We are working on another approach for parent account:

Everytime a student visits a course:

  • we check if there is a parent account for this student
  • we check if the student is a teacher
  • if both answers are NO:
    • we create a parent account with a random password and we extend the unique username of the student with parent_
    • we add the course to the account of the parent
  • if there is already an account, we add the course to the parent courselist
  • we offer the admin two buttons on the user overview page: one for a PDF and one for an exceldump with the list of parents accounts.
  • One of the wishes is that a parent could fill an ask-the-teacher-block and students have another ask-the-teacher-block

Now the question: which role should we give the parent:

  • with this last wish
  • without this last wish
In reply to Ger Tielemans

Re: Importing Parents to Moodle

by John Isner -
Hi Ger,
I like the automatic approach! It makes sense until the step

we add the course to the account of the parent

What do you mean? Do you assign the parent a role in the Course context? If so, what role do you assign?

In the standard setup for parents (Parent role and Mentees block), parents are not assigned roles in courses. They are assigned roles in their child's User context. From the User context they get a keyhole view into their child's courses which allows them to see only their child's work and grades. I don't think it is possible to define a role that would give such a restricted view if assigned in the course context (it would either be able to see too much or too little).

So maybe you should modify this step
  • we add the course to the account of the parent
to
  • we assign the Parent role to the parent in the child's User context

Can we clear this up first? Then we can discuss your "last wish."


In reply to John Isner

Re: Importing Parents to Moodle

by Ger Tielemans -

mm, So I must change that:

We now force for everyone the use of my page, so when a parent logs in with his own parent_username/random password, he sees the parent_abaker_mypage of the child abaker:

on that page he sees:

  • the mentees block, forced as a permantent block (but I must set the rights better: he gets now the answer no rights: roleid is like blocks-id a dynamic value! )
  • (after a patch) the list of courses of his child, but if i activate the href, he is asked to become member of that course, what we do not wish


Question: if it is not possible to see the course through the eyes of the child (is loginas not possible as a forced parameter in the href-link?) is it possible to add a param to the href which gives the parent guest-access? 

In reply to Ger Tielemans

Re: Importing Parents to Moodle

by Ger Tielemans -

Well, guest access is even more legant:

the parent can see the profile aAND the course + activiteis without interfering the process, .. just guest access would be nice!

In reply to Ger Tielemans

Re: Importing Parents to Moodle

by John Isner -
From http://docs.moodle.org/en/Parent_role
  1. Access Administration > Users > Permissions > Define roles
  2. Click the button "Add a new role"
  3. Give the role a name e.g. Parent, short name and description
  4. Change moodle/user:viewdetails to allow
  5. Change any/all of the following capabilities to allow
  6. Click the button "Add a new role"
If you give parents any more (or any fewer!) permissions than this, you are probably breaking the law, at least here in US.

Re loginas: did you notice the risks? I wouldn't even give it to teachers.

Parents should never be able to enter any course (they should never have moodle/course:view = Allow).

In reply to Ger Tielemans

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Ger - Just a few thought for what they are worth. I would not advocate for giving parent loginas privileges. You do not want parents submitting work for their children or posting to a forum as the child. There are privacy issues too. The parent has the right to see what their child has written but not what other children have written. The parent idea can get a bit more complex than it may initially seem. I think the best thing is to define what the parent role should be able to do but to give careful consideration to each. So a parent could view courses but not forum discussions and yet see their own child's forum posts. Peace - Anthony
Average of ratings: Useful (1)
In reply to Ger Tielemans

Re: Importing Parents to Moodle

by John Isner -
I think you are making it too complicated. Everything you want can be done using standard roles and blocks, without any code patches.

  • Create the Parent role, as described in docs.
  • Assign the Parent role to the parent in the child's User context (click the Roles tab on the child's user information page (user/view.php), then click Locally assigned roles then click Parent, then assign the role to the parent.
  • Site administration -> Modules -> Blocks -> Sticky blocks -> Configure MyMoodle -> Blocks add... -> Mentee block.
When the parent logs in, the parent will see the MyMoodle page. The Mentees block will list the child(ren). Clicking a child takes the parent to the user/view.php page for the child. The page will have five tabs as shown below (I made this on demo.moodle.org, and I am viewing Student demo as her parent).

I understand from your earlier post that you want to automate some of these steps, and that is a good thing to do. But I think you should follow the standard approach (Parent role assigned in child's User context + Mentees block), rather than trying to reinvent the wheel.


Attachment student_information_page_as_seen_by_parent.png
Average of ratings: Useful (1)
In reply to John Isner

Re: Importing Parents to Moodle

by Ger Tielemans -

John, you are right: I see on your picture above/I realise that the parent already can enter the courses on the user profile page: this gives the parent a global view: resources yes, test content and assignments not.

After correcting the roleid in the code for the parent-account, everything is working now! We get a parent account when the student enters a course and this parent gets as a bonus a nice my page: we stick to your role concept. (We even do not allow to change the child's profile page.)

So, having these parent_account active, we can now start to think about filtering blocks by role-type..

Thanks for the comments, you too Antony, I agree on the privacy and interfering points.

Attachment parentmypage6.jpg
In reply to Ger Tielemans

Re: Importing Parents to Moodle

by John Isner -
Hi Ger,
I'm glad it's working. Remember, the parent never "enters" any course. The parent can only peek into the slice of the course related to the child. The parent is confined to the child's User context (see image -- child wearing hat).

we can now start to think about filtering blocks by role-type

Now that I see your MyMoodle screenshot, I understand the problem. You don't want parents to see the same blocks that students see, but only the Mentees block. It is an interesting problem, but I doubt you can solve it with roles, since there is no way to tell a parent from a child when they first login, because they have the same role (Authenticated user) when they first login and are in the System context. Then the child goes "down" into his course context, and the parent goes "down" into the child's User context. Now they have different roles (Student for child, Parent for parent), but it is too late, since they are no longer on the MyMoodle page. I think it shoudl be a new issue in the tracker.


Attachment parent_and_child_context.png
In reply to John Isner

Re: Importing Parents to Moodle

by Ger Tielemans -

Interesting, how complex!!

Mmm, thanks, I have to find another direction then roles to solve that:

  • they only arrive on the my page when they login succesful
  • Because the usernames of all parent accounts start with the prefix parent_ we can put the check on this as a filter in block conditions:
    •  if head of username is parent_ ..show special parent block
    •  if head of username is parent_ ..hide some other blocks
                                     something like the login block
In reply to Ger Tielemans

Re: Importing Parents to Moodle

by John Isner -
Filtering on usernames will work, but it is a throwback to an old way of doing things. It would be better to somehow do it with roles. Take a look at MDL-14298 ("Provide triggers that cause automatic role assignment when a user enters a context"). With a trigger "User name matches regular expression parent_*" parents could be automatically assigned a role that would control block visibility. I will add a comment to MDL-14298 pointing to your use case, which I think is a very important one!
In reply to Ger Tielemans

Re: Importing Parents to Moodle

by Jamie Tinley -
Hi Ger,

I see you use Parents at the beginning - I was just thinking of doing that for the purpose of sorting them more easily when I have to manually search because there is no other way to sort users, correct? Similarly, I was thinking of naming all students as Student_lastname and then Parent_lastname. is this a good idea or will I regret this? (200 students, 25 teachers, moodle 1.9, apache)

Thanks, I'm following your thread.

James
In reply to John Isner

Re: Importing Parents to Moodle

by Greg Jeffrey -

Hi Guys.
"Remember, the parent never "enters" any course."
At the moment I have Parent and Student set up and linked.  When I log in as a Parent I see the child and can click and see his profile.  If I  click on a course from there I can see the outline and complete activity reports (with any assigned grades etc.).  However if I click on any of the materials - handed in work, forum posts etc. it tells me "You are about to enrol yourself as a member of this course." If it is passworded I get no further and if not it lets makes my parent a student in his own right!  (Activity report says there is one Forum post but the Forum tab tells me there are no posts - either way I can't see it.)
So does anyone have an idea what I have missed?
Greg

In reply to Greg Jeffrey

Re: Importing Parents to Moodle

by Ger Tielemans -
In our approach parents get guest access in the courses of their child AND we give them guest access in any course. With that right they can see the outline and the resources in a course. After a long thought we switched the guest view for the forums off, so the real interaction in the all the activities is between the teacher and the students. We create two zones: one - where the courses are - is open for guests, students and parents, the other one is only open for teachers and staff.
(I have to document our approach better, sorry)
In reply to John Isner

Re: Importing Parents to Moodle

by Jamie Tinley -
Hi John,

I read the tracker link and discussion - am I correct that using a CSV upload of parents assigned to their kids (mentees) will not be available until moodele 2.0? Or can we do it now? I don't get the instance number - if users are 30, but you want the parent to be assigned to them in ALL instances (courses), then what would you use? (so it looks just like it should - parents log in and in mentees block they see their kids)? THanks

James
In reply to Jamie Tinley

Re: Importing Parents to Moodle

by John Isner -
Hi James,
I think "will" is too strong a word. Right now it is just an issue in the tracker and it has not been assigned to a developer yet. Once it is assigned, there will probably be further discussion. It will be dropped if there is not enough support for it, or if the developers consider it too difficult to implement. In the best case scenario it will be included in Moodle 2.0. Thanks for voting for it.

you want the parent to be assigned to them in ALL instances

No! You never assign the Parent role in a course context. You assign the Parent role to the parent user in the child's User context. This SINGLE role assignment gives the parent the ability to peek into all of the child's courses.

Regarding the number 30: I was suggesting a general way of specifying contexts in csv files. My suggestion was to use two numbers: (context type,context id).

The number 30 is the internal Moodle code meaning User context. The number 104240 is my user id. To specify my User context here on moodle.org, I used the pair of numbers (30,104240). This is the context I would specify when assigning the Parent role to my father.

The two-number scheme can be used to specify any context, not just User contexts. To assign a role in the Roles and Capabilities forum (this forum), I would write (70,6826). 70 is the internal code meaning "Module context" and 6826 is the forum id.

In reply to John Isner

Re: Importing Parents to Moodle

by Jamie Tinley -
HI John,

Thanks, I know how to assign the parent role inside a child account but I did not realize how to describe it. Thanks for clarifying it is a role, not a course.

For now, how can I best assign parents to each Mentee? (manually is a pain with 200 students). I saw Anthony Borrow's download but I did not understand it - the part on creating a sql database linking parents and students. Do you know a hack so I can do a csv upload (which I get) or can you explain Anthony's mass mentee import download? Thanks John,

James
In reply to Jamie Tinley

Re: Importing Parents to Moodle

by John Isner -
At the moment, the best you can do is manual. From his last post, it sounds like Anthony will soon have a script that you can use.

Anyone who wants to see a general solution to this problem (not one specific to Parent role assigment) should vote for MDL-15187.
In reply to Natalie Jordan

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
OK - here goes a first attempt at explaining things. First off, I would start by reading http://docs.moodle.org/en/Parent_role.

Most folks get the idea of creating the role_assignment; however, the concept of contexts throws a wrench in things. There are various context levels - the context level for a user is 30 and then the instanceid refers to the users mdl_user id field. So the parent gets assigned the role of parent for the context of the child. I am attaching a sql script to be used as a rough reference for one way of attacking this issue of doing a mass import of parents. It is meant to be used as a guide to show the steps that I used on a test server with test data. Please let me know if you think there are dangerous oversights that might corrupt data. Use the script in so far as it is helpful and otherwise avoid it. Peace - Anthony
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Jalil K -

Thankyou Anthony,

Your script works an absolute treat! I made one small alteration on line 52,substituting mr.name to mdl_role.name

Thanks Again, you've saved me alot of work(I was at one stage contemplating manually entering these in)!

In reply to Jalil K

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
You are most welcome. I'm glad the script was helpful. Happy Moodling!
In reply to Anthony Borrow

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I am not sure how you might be able to get a parent to automatically be assigned a parent role on initial login with LDAP authentication. Currently, it is not possible. I suppose that with a little coding it might be possible but unfortunately I am not familiar enough with LDAP to be of assistance.

Inaki may have some ideas. Essentially the username or userid of the student would need somewhere in the ActiveDirectory information (probably as a comma separated list). Either way there would have to be some agreement about the name of the field, etc.

My initial response would be to not have LDAP create the account and go ahead and create the account in Moodle and assign the parent roles and then let them authenticate using LDAP. A little work at the beginning will likely save you time and worry down the road.

I do not see how it would be possible for a parent to see a child's courses without being enrolled in the course. The mental association that we make between a parent and child is not one that Moodle makes. In other words, there is no inherent connection between users. Each user has capabilities to perform various activities in given contexts (one of which is the user context).

One option is to avoid parent accounts and encourage the parent to sit down with their child as the student is logged in. This allows the parent to see what the student sees while allowing the student to remain responsible for his or her own learning.

Peace - Anthony
In reply to Anthony Borrow

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I recognize that we do not live in an ideal world. Course events (like assignments, quizzes and the like) are linked with the course. As such, the parent would need to have some type of association with the course. Being able to view the course may be the best solution and then your school could decide if they want the parent to be able to view assignments. It could be that being able to view the course is enough. It is always a fine line and there are seldom easy solutions. The problem I see with the RSS feed is that the parent would only want to see the assignments and events that impact their child. Your idea of an RSS feed or some type of exporting event is interesting and may well become possible with Moodle 1.9 and the ability to handle events. You may want to continue to develop your ideas about what you would like to see happen and add it to the tracker as a feature request. I'd be curious if others have any ideas about how to accomplish this. Peace - Anthony
In reply to Anthony Borrow

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Anthony Borrow

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Justin P -
First off I'd like to say "Anthony you are awesome!" I've been working towards automating the creation of parent roles for a while and this doc has completed one of the major steps.
If anyone is familiar with customizing the LDAP code and would like to help me out with the other major step please see - http://moodle.org/mod/forum/discuss.php?d=77062#p342708

I've attached the php file I created with the help of Anthony's sql file. If anyone would like to clean it up and make it work better/faster/stronger by all means do but please repost the results so that we all can share in the enjoyment.

Notes-
  • Script pulls parent name from column created manually in mdl_user table.
  • I'm not a super strong php or sql writer, so be kind if you are one.
  • I was planning to have this script run each night along with cron.php
In reply to Justin P

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Justin - Thanks for sharing your code. I've been wanting to take the sql to the next step but have not had the time to play. Peace - Anthony
In reply to Justin P

Re: Importing Parents to Moodle

by Justin P -
Oops!  I just relized that I left in some code I was using for testing.  I've attached the script without the testing code.
In reply to Justin P

Re: Importing Parents to Moodle

by Marc Grober -
I was wondering if you might not take a crack at how one could use the bulk user upload to further streamline this. Once the table was made I would think one could add the additional field to the upload template and link via name....
In reply to Justin P

Re: Importing Parents to Moodle

by Jamie Tinley -
Justin, GER, John, Anthony

I know anthony is too busy to re-write this code. However, it appears both Anthony and Justin already made it work in the mass parent creation and assign parent modules. I really need this to work but don't understand how to create the sql table it reads from or where to place this php.

My situation has changed dramatically. Our moodle courses were opened up to many more students than I had expected. Plus, my main IT admin could not tell me which students are going to use our Moodle course and which will homeschool on their own (why I am trying to understand). I was recieving so many emails (50 a day) from frustrated users with no username/login that I had to import EVERY student 7th to 12th. That way any errors are user errors knowing how to login. I automate this weekly now and create parents accounts with their same name for ease of finding the right one to attach. (stu_johnsmith and Par_johnsmith)

That's over 2000 users now! It's painful attaching them manually. Plus I have to attach teachers to all of them so they too can check on their students. Now they want to add 6th too! Currently I am so overwhelmed with emails that I can only do a handful of attachments at a time. I trained a secretary to help but she is limited on time too. I sort by most recently logged in assuming those not using it don't need this feature yet and won't complain.

Please help me understand how to make this php plugin work or a way to sort users to see who does NOT have an attachment but IS using moodle (enrolled in a course). I like Ger's auto attach when enrolling but don't know how to set it up either. Thank you for any help on the mass creation or assign parent module setup.

James Tinley
In reply to Justin P

Re: Importing Parents to Moodle

by Lael ... -

//Split apart supervisor table element
  $sup = explode(" ", $row_pull_name['supervisor']);

//Count array elements
  $sup_count = count($sup);
  
  //Save supervisors first name
  $sup_fname = $sup[0];
  
  //Save supervisors last name
  $sup_lname = $sup[$sup_count-1];

Justin - looking at this code, I was unsure of what was happening in the supervisor field. Is there a specific format required for the supervisor? eg: firstname lastname or similar?

Lael

In reply to Lael ...

Re: Importing Parents to Moodle

by Jamie Tinley -

Hi Lael,

Is your question also about using the mass parent creation for mentees?  If so, perhaps we can work together to figure out how it works.  Someone already made it and used it, so it must work if we figure it out.  I'm stuck on creating tables in the step below- do you know how to do that? I see database now in server props, but don't know how to add a table? I feel so close now.

==> ??? using ODBC or some other method create a table called parent_list which contains the parent and child usernames paired together as one record. The script assumes the field name are parent_username and child_username

CREATE TABLE `parent_role_assignments` (
  `parent_username` varchar(100) NOT NULL default '',
  `child_username` varchar(100) NOT NULL default '',

.

.

.

==> ??? pull in the data from your parent list table that contains parent_username and child_username\

In reply to Jamie Tinley

Re: Importing Parents to Moodle

by Lael ... -
Hi Jamie,

I will be looking at this with some others on Monday. Will let you know how we get along.

Lael
In reply to Lael ...

Re: Importing Parents to Moodle

by Marc Grober -
Been trying to get a handle on this (I missed this thread first time around) so here is what I have found to date as a bit of a recap.....)
http://moodle.org/mod/forum/discuss.php?d=106157&parent=467792
I also started a new thread in this forum because this thread, as is so often the case can get a bit convoluted, so its there if you want to use it....
Also posted it to Developers Forum
In reply to Lael ...

Re: Importing Parents to Moodle

by Jamie Tinley -
HI Lael,

Thanks - glad to know this is active again! I would love it to work, which it was working at least once before but just needs upgrading and instructions - they main part confusing me on Anthony's directions was directions to making an sql table in moodle. Thanks for working on this and replying.

James
In reply to Lael ...

Re: Importing Parents to Moodle

by Jamie Tinley -
Hi Lael,

what did you find out about making the mentees parent mass creation work in 1.9? Looking forward to your reply - please keep this moving forward! It seems so close if it already worked in 1.8 by Anthony come it can't work for 1.9. I need to learn PHP as I just can't take it any longer and would solve things myself but don't know anything except vba programming! Thanks for your expertise

James
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Pablo A. Rueda U. -

Greetings to everyone...

This is actually my first post in a moodle forum.. I have been using moodle for a while and now the school where I work wants me to focus on the administration of our virtual campus (http://200.114.0.11/aula/)...

I am focusing on the creation of parents' roles but I have to confess that I have no idea about how to use the SQL scripts that you have shared here. I understand the code, but I honestly don't know how to use it into moodle...

Can anyone help me with this??? Is there any wikihow about it???

Thanks again for your help.

In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Jamie Tinley -
Hi,

I love the idea of mass parent creation and am stuck on how to do it. I imported parents just fine but I do not have much knowledge of how to create a sql database. Can anyone give me detailed instructions step by step of how to do this? I have 200 students to enter and I could really use this feature. Thanks in advance for helping this novice admin out.

James
In reply to Jamie Tinley

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
James (and others) - I hope to have some time this week for Moodle related projects. I will put this on my list of projects to try and work on. I think it would be a great way schools to get parents involved. Essentially what I am thinking at this point is that you would use the normal import user functionality and then create another text file with the usernames of the student and the parent. So if you have student Adam Baker with a username of abaker and Parent Baker with a username of abaker_parent then the text file would simply contain entries like:

abaker, abaker_parent
cdempsey, cdempsey_parent
efish, efish_parent
ghall, ghall_parent

Then we would add a link to import mentee assignments which would go in and create the role assignments for each listing, reporting progress and errors along the lines of:

assignment successful: abaker_parent is mentee of abaker
mentee's username not found: cdempsey_parent
student's username not found: efish
mentee's username not found: ghall_parent
student's username not found: ghall

If the role assignment already exists, I think I will just report it as being a successful assignment. Does this sound like a reasonable/helpful approach?

Peace - Anthony
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Jamie Tinley -
Thanks Anthony,

That would be great! Would this replace your previous mass mentee download method?

As a background to my questions, my school has 2000 homeschoolers:
300 are High School students
25 Moodle h.s. course teachers
75 ES's - "homeroom" teachers who must track, not grade, student progress

I created two roles for mentees, parents and ESteacher. Parents rarely change (some do- custody reasons) but ES ("homeroom teacher) student's change often. ES's have the same privileges as parents so I could use just one but I was trying to give ES's the ability to grade ONE assignment monthly for the progress they see. This failed as mentors should not be able to enter course of mentee. So Instead, my current plan is for 75 teachers to send me monthly progress for their students on excel which I link on one master which I can sort by course and then will export as csv and then import into each course as a one grade - ug!)

I'm thinking of using Parent_jsmith and Student_jsmith so I can sort them easier.

Questions:

1. If I want each parent to have their own name, not a generic parent_jsmith, could the csv handle multiple ones by adding them with commas?


JSmith, parent_SueSmith, parent_JerrySmith

2. What about other roles like parents (my ES role) - could it handle more than one mentee defined role?

jsmith, ES_LarryMcdoogle

3. When students change for the ES or parents, will I have to delete that role manually or can it automate UNlinking a parent/ES to a mentee?

jsmith, ES_LarryMcdoogle, - ES_BradHunt

I hope I'm making sense. Also, in Moodle Tracker MDL-15391 I explain that it makes more sense to me to link them the other way around:

parent (or ES) with different students and use specific parent NAME
I have up to 30 students to select for any one ES, so that would save me time to list the parent or ES first, and then their students or kids. It's more intuitive too, at least for me.

ie

parent_Dsmith, student_jsmith, Student_Csmith, Student_lsmith

Parent_WJones, Student_jsmith, Student_Csmith, Student_lsmith, student_bjones

ES_pborba, student_jsmith, Student_CLee, Student_lharris, . . . . . . .

The ES's 30 students may change during the year.
again, a way to remove a mentee's parent/es would be helpful with adding: -student_lharris or something like that.

I hope some of this makes sense

James



In reply to Jamie Tinley

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
James - I'm starting this morning to work through a long list of backed up Moodle projects. When I get to this I will have to check and see what is currently available for assigning mentees to students. Just a brief response to some of your questions. Regarding #1, I think if you are going to be assigning more than one person as a mentee for a student that should take place on two lines since they are in fact two separate assignments. Regarding #2, I was reading somewhere that during creating a user one could assign a global role to that user. Having the ability to use a text file to add (or remove - in response to #3) a role assignment would be a good idea. At this point, I'm not particular about the order of the fields but we will want it to be intuitive. I tend to think of the student first (since at a school that is whom I primarily deal with and know). This student has a relationship with the mentor or ESteacher so it seems reasonable to user student username, mentee username, role name (perhaps even having that be an optional field but parent by default but it seems a little risky to make a non-standard role the default). I can see some utility in allowing the context to be given as well but how to do this might be phase two of this effort. Of course all of this depends on what may already have been done which I have not looked at. Diving into this will likely mean tackling some of the other related issues in the tracker. Thanks for your patience. Peace - Anthony
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Jamie Tinley -
HI Anthony,

Where will you be posting this csv download? Or will it be an update to the cvs code in moodle? I don't know if you saw the tracker MDL-15187 which is the same solution you are working on. John there says it is worded strange but that this link
http://moodle.org/mod/forum/discuss.php?d=91436#p436787

talks about global roles in csv updates and somewhere else John talked about mentees roles. Anyway, this tracker was 'hoping by 2.0' it could be implemented - so I'm hoping too but instead that you might figure it out before August when I have 200 students and 200 parents to link and 75 ES's that change students all the time! Thanks for your help and please post where you will put this download or update so I can try it - thanks Anthony

James
In reply to Jamie Tinley

Re: Importing Parents to Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
James - I'm not sure if I will be able to commit to doing it but I will post whatever progress I make to MDL-15187. Thanks for helping us to develop the ideas that will hopefully make this possible. There are other ways that we can help you with your assignments if we do not have this code done so I would not worry too much about the assignments. Besides, relatively speaking 200 is not that many. Peace - Anthony
In reply to Anthony Borrow

Re: Importing Parents to Moodle

by Jamie Tinley -
Hi Anthony,

Bummer, I was hoping to see it but I know you are very busy and in high demand for many important projects. I guess 200 is not much but once we get started I may be asked to have all 2000 in some Moodle related activity to satisfy our computer goals and parent requests. The hardest part for me is the 75 ES's with 25-30 students each that keeps changing monthly. Having that automated like a csv file would really help me out. Since MDL-15187 may not happen until Moodle 2.0, can you explain how to use your original mass import download?

Thanks Anthony,

James
In reply to Jamie Tinley

Re: Importing Parents to Moodle

by Dan Jeffries -
Hi

There's a lot of info in the past that goes *whoosh* over my head - so apologies if this has been asked and answered!

We are using the PLP block and need to assign tutors to students so they can feedback on their Personal Reports.

Doing this is proving very time consuming - is there a mass way of doing this?

Hope someone can help!

Dan
In reply to Dan Jeffries

Re: Importing Parents to Moodle

by Mike Worth -
I wrote a script to assign personal tutors to students; it was written while I was still learning about moodles libraries etc so is pretty messy code, and has various things hardcoded into it for my particular usage. It can be found here: CONTRIB-924

Parent access is my next big job, and I will probably be re-visiting this code and cleaning it up/ making it more flexible.

If you've got any questions ask away,
Mike
In reply to Dan Jeffries

Re: Importing Parents to Moodle

by Marc Grober -
Anthony was I think going to pursue using a csv file to allow upload of mentee data..... but I have not seen anything on this recently.... I will try to put a bug in Anthony's ear; I know he has been busy of late.
In reply to Marc Grober

Re: Importing Parents to Moodle

by Lael ... -
I just found this online - haven't looked at it yet to see how it works, but seems interesting - and similar to what people are talking about here:

http://mylescarrick.com/articles/automatically_adding_parents_to_your_moodle
Average of ratings: Useful (1)
In reply to Lael ...

Re: Importing Parents to Moodle

by Maxime Pelletier -

Hi all,

I know it's quite an old thread but AFAIK, it's the one that contains to more useful information about parent role in Moodle.

I updated a piece of code written by Penny Leach to sync parent role from an external DB to work with Moodle 2.3.

In short, you need an external DB with 3 columns: student_username, parent_username and role_shortname. That's it! The plugin will assign (and unassign if needed) the role accordingly.

You can find to code here:

https://github.com/maxCSA/moodle-enrol_dbuserrel

I havn't had the time to test it as I would like to but it seems to work well. Let me know if you find any bug in it.

I might need to rename a couple of thing in there because it could be used for mentor/mentee relationship as well. Also, keep in mind that it's still in beta state.

Regards

In reply to Maxime Pelletier

Re: Importing Parents to Moodle

by Maxime Pelletier -

Hi again,

We finally realized that it was better to get the child-parent relationship from LDAP, so I created a new plugin importing user role from LDAP.

You can find the code here:

https://github.com/maxCSA/moodle-enrol_ldapuserrel

All parent/mentor entries in LDAP must have an attribute containing the list of chlid/mentee unique identifiers.

Let me know what you think about this.

Regards

In reply to Maxime Pelletier

Re: Importing Parents to Moodle

by Heather Edick -

Hello, Maxime!

Thank you so much for doing all this work.  I have a question, though.  When I run the sync.php from the command line (I am using Xammp on Windows), it starts the synchronization process and then just stops.  I have set up the database correctly, I think, but if you could perhaps provide an example of the settings one should use, that would be great. 

In reply to Heather Edick

Re: Importing Parents to Moodle

by Maxime Pelletier -

Hi Heather,

Sorry for not answering to your post, I didn't get any notice about your reply...

In case someone else have this problem, I suggest adding the "-v" option to activate verbose mode.

If you find the solution in the meantime, maybe you could share it smile

Regards