• Resolved benorange

    (@benorange)


    Hi,

    I am looking for support to allow parents with multiple children accounts to view course results together. Thanks in advance.

    As I see it, we could use this plugin to create a group for each family and allow family group users to see a ‘family view’ link.

    Imagine 2 siblings attend the same course, we are working towards the parent being able to see both childrens’ results in one place without having to log in twice to compare the results.

    Does anyone have advice about how we could use this plugin, or more likely this plugin with another, to allow parents to see data/results from more than one user account at the same time?

    Bw,
    Ben

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Kento

    (@proaktion)

    Hi Ben,

    For example, you could approach this by creating one group per family.

    Create a user account for each family member who should be able to access protected pages.

    Protect each page that a family should be able to access with their group (see this documentation page for details on how to do that).

    Now when any of the members logs in, the account can view the protected pages.

    If you also allow family members to create pages, you can assign them e.g. the Author role and allow that role to Restrict Access (see this documentation pages on how to enable that).

    I think this should cover what you want to achieve nicely. Don’t hesitate to follow up if you have questions.

    Cheers

    Thread Starter benorange

    (@benorange)

    Hi @proaktion,

    Thanks. Interesting reading.

    Would each family require a different custom page each to view group data?

    The score page will be the same page for each user so I am guessing I still need to handle the ‘custom query and page with access to other users data’ part of problem. This is helpful though for how to display. I guess we’ll need a cutome page for each family but there are not too many.

    Users don’t need to create pages, only view data from child dbs and upload new results if possilbe.

    Thanks again.

    Bw,
    Ben

    • This reply was modified 2 years, 5 months ago by benorange. Reason: thought about it
    Plugin Author Kento

    (@proaktion)

    I think it could also be useful for you to have groups that classify “Parents” and “Children” in general, as it could make it easy for you to obtain the related users for your custom query.

    For example, let’s say you wanted to obtain the children of the “Addams” family, you could first obtain all users that are in the “Children” group and then intersect those with the users in the “Addams Family” group (see API examples). You’d get only the user accounts of the children without their parents (although the parents also belong to the family group). Then you could do your query for the score page for those children accounts to display using a custom template.

    So to answer your question:

    > Would each family require a different custom page each to view group data?

    Not if you approach it in the way I’ve suggested above and check which family group the viewer belongs to. If you assume that the viewer (the parent) belongs to a single family group, you could obtain that via Groups’ API and use it to dynamically obtain the results.

    Here’s a piece of code using Groups’ API you could use to start crafting your solution (made it explicit and without checks so it’s easier to follow):

    
    // Children and family group names
    $children = 'Children';
    $family = 'Addams Family'; // you would use that of the viewer
    // Get the children group object
    $children_group = Groups_Group::read_by_name( $children );
    // Get the family group object
    $family_group = Groups_Group::read_by_name( $family );
    // Get the user IDs of all Children group members
    $children_user_ids = $children_group->user_ids;
    // Get the user IDs of everyone in the family
    $family_user_ids = $family_group->user_ids;
    // The intersection gives us the children of the family
    $children_user_ids = array_intersect( $children_user_ids, $family_user_ids );

    On the examples page I’ve linked to above you can see how to obtain the groups that the current user belongs to and adapt the above accordingly.

    I hope that helps a bit, do ask if you need more help.

    Thread Starter benorange

    (@benorange)

    Thanks @proaktion,

    I will do some work on this. Before I follow up. Grateful for you taking the time.

    Bw,
    Ben

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Family accounts’ is closed to new replies.