courtly
courtly
courtly
courtly

Upcoming Events

San Francisco CiviCRM Meetup - February 8th, 2012
February 8th, 2012
Come meet others from the Bay Area who are interested in, using or developing (more...)

UK usergroup - London meetup
February 8th, 2012
Come and meet others from the UK that are using CiviCRM or are interested in (more...)

Chicago CiviCRM Meetup
February 17th, 2012
Please join other CiviCRM users, administrators, and developers in the Chicago (more...)

London user and administrator training
February 23rd, 2012
A comprehensive two day hands on training course covering the configuration, (more...)

CiviCRM London sprint Feb 2012
February 27th, 2012
Following the CiviCRM training here in London, we will have a CiviCRM code (more...)

Philadelphia - CiviCRM Meetup for Q1 2012
March 13th, 2012

UK South West - CiviCRM Meetup
March 20th, 2012
Come meet others from the Area who are interested in, using or developing for (more...)

[Bristol, UK] user and administrator training
March 21st, 2012
A comprehensive hands on training course covering the configuration, (more...)

San Francisco user and administrator training
March 29th, 2012
A comprehensive two day hands on training course covering the configuration, (more...)

CiviCRM Usability, Test and Code Sprint - San Francisco (March 2012)
March 29th, 2012
This usability, code and test sprint is targeted at CiviCRM users and (more...)

CiviCon 2012 San Francisco Bay Area - April 2nd 2012
April 2nd, 2012
CiviCon is THE annual event bringing together the people who use, develop, (more...)

CiviCRM Documentation, Test and Code Sprint - after CiviCon San Francisco (April 2012)
April 4th, 2012
This sprint is targeted at CiviCRM users and developers who want to work on (more...)

CiviCRM Components

Tools for engaging your supporters...

CiviContribute


CiviEvent


CiviMail


CiviMember


CiviReport


Exposing relationship data in CiviCRM profile view

Not Just a Contact Database

These optional components give you more power to connect and engage your supporters.

  • civiCASE

  • Case management for clients and constituents.

  • civiEVENT

  • Online event registration and participant tracking.

  • civiMEMBER

  • Online signup and membership management.

  • civiMAIL

  • Personalized email blasts and newsletters.

  • civiREPORT

  • Report generation and template management.

July 29, 2009 - 11:53 — lobo

I'm working on deploying CiviCRM for my kids school website. Part of the project requires us to expose the parent <-> child relationship information on the website and allow parents to edit their child information.

I accomplished this using a combination of civicrm hooks, custom templates, permissioned relationships and custom code in a drupal module. You can access the module and template code here.

The broad steps are:

  • Implement hook_civicrm_pageRun for the profile view page (CRM_Profile_Page_Dynamic). Only implement this hook for the specific profile id's you want relationship information. In this case we have two profiles, a Parent Profile (gid=3) and a Student Profile (gid=4)
  • The pageRun hook also adds the module's template directory to the smarty include path, so we dont have to set it globally. This also allow multiple modules to append different template directories to the template include path (check the function _sfschool_initialize)
  • The hook gets either the parent or the child information using a custom query. We ensure that only permissioned parents can see their child information (in case of some complicated family structures). The queries are relatively simple at this stage, i suspect they will increase in complexity over the next few weeks
  • The hook exposes the information gathered from the database to the smarty template
  • The custom template (templates/CRM/Profile/Page/3/Dynamic.tpl) uses that information to display the relationship data on the page. I also edited the View.tpl template to eliminate the "Back to Listings" link.

The school is currently exposing the data as read only (the primary database is a commercial SIS system). We will import the data from the SIS system and set the relationships via import. We will need to do a manual SQL query to give parents permission on all their children relationships. I suspect you can edit the profile edit/create forms via hooks to also gather relationship information via the form and create the appropriate permissioned relationships. I dont think that this will be a requirement for the school anytime soon, so i do hope someone from the community steps up and implements this.

I did all the development on a local box and then migrate the custom data / profile information to the production server using the scripts in bin/migrate/{export,import}.php. They work quite nicely for the most part :)

I'll be doing quite a few more things for the site via a combination of hooks and custom code. More blog entries on them as i figure things out ...

Comments

demo site available?

Where can I see a demo website with this code in action?

its a client website ..

as such there is no public demo available. You will need to download and install the modules to see it happen. at some point, we might decide to make a public demo available

lobo