CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille
Pages: [1]

Author Topic: Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille  (Read 2739 times)

mcloud001

  • Guest
Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille
April 25, 2010, 03:02:25 pm
Hi
I am trying to use Advanced Profile Kit to Display CiviCRM data in Drupal User Profille, but have been unable to find how to Import my CiviCRM Custom fields into the User Profile.  I have read through the help  and imported the content of uprofile.full.export so I can get familiar with the process. However I cannot work out how to  Import my CiviCRM Custom fields into the User Profile or even if it is possible.  Any pointers or help on how to do this much appreciated, thanks.

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille
April 26, 2010, 05:00:49 am
Hi,
Advance profile provides panel page for user view page, which override default user display. Hence there may be a possible solution is to create a block which will fetch user profile data from CiviCRM , this block you can add on panel page.

Block code may be as following

Code: [Select]
<?php

if ( ! civicrm_initialize( ) ) {
        return;
}
 
require_once 
'api/UFGroup.php';
if ( 
arg(0) == 'user' && arg(1) ) {
if ( 
$cid = crm_uf_get_match_id(arg(1)) ) {

echo 
"
<div id='civiprofile'> </div>
<script type='text/javascript'>
$.ajax({
  url: 'yourdrupalurl/civicrm/profile/view&reset=1&id="
.$cid."&gid=1&snippet=2',
  success: function(data) {
    $('#civiprofile').html(data);
  }
});
</script> "
;

}
}
?>


Note that, gid will be your CiviCRM profile ID

mcloud001

  • Guest
Re: Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille
May 03, 2010, 03:00:18 am
Hi Rajan
Thanks for your help, much appreciated, will experiment :-)

Traveler777

  • I post occasionally
  • **
  • Posts: 43
  • Karma: 0
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.2
Re: Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille
March 14, 2011, 09:40:59 pm
Yes, it is possible to pull CiviCRM data (basic + custom) via views (block) in the APK (Advanced Profile Kit) panel.

I hope someone can help on the following:

To my understanding, to show a member profile page with APK you need a Drupal user account. This shows like user/Traveler777. This is no problem for all individuals registering through CiviCRM contribution forms, because "Register for Drupal" is enabled. The end result is a APK for individuals pulling in the custom fields through views.

Now, how do we do that for organization members (they don't have a Drupal account and no option to "Register for Drupal" during sign up? We don't only want to show individuals through APK, but also organizations with specific custom fields pulled from CiviCRM with views.

Did anyone go through this before and would like to share some ideas/possible scenarios.

Thanks!

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille
November 28, 2011, 09:21:51 pm
I've been trying to get this to work and it seems the code is outdated.

For one thing,
Code: [Select]
require_once 'api/UFGroup.php'; would need to change to either
Code: [Select]
require_once 'api/v2/UFGroup.php'; or
Code: [Select]
require_once 'api/v3/UFGroup.php'; - I'm not sure which.

I've changed
Code: [Select]
"&gid=1&snippet=2' to
Code: [Select]
"&gid=11&snippet=2' (11 is the ID of the profile), but I still get a WSOD.

Any ideas here, or any other suggestions on how to pull CiviCRM fileds into APK? Thanks much - this seems close!
« Last Edit: November 29, 2011, 07:51:12 am by bcobin »

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille
November 30, 2011, 05:52:50 am
Answered my own question here - evidently the crm_uf_get_match_id function is deprecated and replaced by civicrm_uf_match_id_get, which resides in the api/v2 folder.

So the updated snippet would be:

Code: [Select]
<?php

if ( ! civicrm_initialize( ) ) {
        return;
}
 
require_once 
'api/v2/UFGroup.php';
if ( 
arg(0) == 'user' && arg(1) ) {
if ( 
$cid = civicrm_uf_match_id_get(arg(1)) ) {

echo 
"
<div id='civiprofile'> </div>
<script type='text/javascript'>
$.ajax({
  url: '[your site URL here]/civicrm/profile/view&reset=1&id="
.$cid."&gid=11&snippet=4',
  success: function(data) {
    $('#civiprofile').html(data);
  }
});
</script> "
;

}
}
?>

I used snippet 4 instead of snippet 2; snippet 4 had simpler formatting. (Snippet 3 is the printer-ready page.)

What I had really wanted to do was less for APK than for Advanced Forum - I was trying to collect the user data in Civi so forum posts could be formatted to have the author listed as "John S. - Ronkonkoma, NY" when the data collected was "John Smith, Ronkonkoma, NY 11766," but teasing the data out (not to mention manipulating the last name) is well beyond the scope of my abilities.

For now, I'm punting here, but others might find the updated code useful. In the meantime, if anyone has any ideas how I might be able to accomplish my original objective, suggestions are most welcome!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Using Advanced Profile Kit to Display CiviCRM data in Drupal User Profille

This forum was archived on 2017-11-26.