Community Documentation

Outputting full civiCRM profile to custom profile

Last updated August 26, 2009. Created by Andrupal on April 5, 2007.
Edited by ronald_istos, add1sun. Log in to edit this page.

Assuming you have already made the template.php and user_profile.tpl.php changes recommended on the parent page of this book, the following snippet allows you to output a whole "profile" from civiCRM into a custom user profile. (The civiCRM profile elements will still obey all the visibility settings you give them...) The theming of this output is still controlled by the civiCRM stylesheets, however, so the customization it actually offers is rather minimal.

I'm a bit of a hack, so please offer suggestions if you have them!

<?php
if (module_exists('civicrm')) {
   
civicrm_initialize(TRUE);
$array = civicrm_view_data($user);
//replace Profile Name with the name you gave the profile in civiCRM
print_r ($array['Profile Name'][0]['value']);
}
?>

About this page

Drupal version
Drupal 5.x
Audience
Themers

Theming Guide

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.