Jump to content
Graham Quince

Parents view of Teacher email addresses

Recommended Posts

Here's something you might like to experiment with...

This code below searches for the children of a logged-in parent, displays them, lists their classes and then displays the teachers of those classes with a link to their email address:

    .childlist {
        border: 1px solid #CCCCCC;
        border-radius: 10px;
        padding: 10px;
        font-size: 14pt;
        line-height: 14pt;
        width: 40%;  
        float: left;
        margin: 10px;
    .childlist a {
        color: #FF0000;
        font-weight: bold;

<div class="emailList"></div>

var emailList = this.element.find('.emailList');

var getGroupsforChild = function(child) {
    Frog.Model.api('groups.getFor', {
        identity: child.uuid,
        group_type: "Class"
    }).done(function(groupResponse) {       
        var groupString="";              
        $.each(groupResponse.data, function(index1,group) {
                var classid = child.user_uuid+index1
                    /* Now run the function to list all the members of the group */
                    groupString+='<li class="Class'+classid+'">'+group.name+'</li>'
            '<div class="childlist">'+
            '<h3>'+child.displayname+"'s classes:</h3>"+

var getTeachersforGroup = function(group,classid) {
    Frog.Model.api('groups.getMembers', {
        uuid: group.uuid
    }).done(function(membersResponse) {
        var members = membersResponse.data,
            TeacherString=" - ";
        $.each(members, function(index2,member) {
                /* This IF statement looks for Staff profiles */
                if (member.profile.name==="Staff" || member.profile.name==="Admin") {
                    TeacherString+='<a href="mailto:'+member.email+'">'+member.displayname+'</a>&nbsp;&nbsp;'
        if (TeacherString!==" - ") {

/* First, get each child of the parent */
Frog.Model.api('users.getChildren').done(function(listResponse) {
        var children = listResponse.data;
        $.each(children, function(index,child) {
            /* now run the function to list all the groups */

@adamw helped me refine this script and showed me some more APIs I wasn't aware of.   

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...