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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • getting the contact id within hook_civicrm_alterContent
Pages: [1]

Author Topic: getting the contact id within hook_civicrm_alterContent  (Read 700 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
getting the contact id within hook_civicrm_alterContent
March 02, 2012, 05:19:52 pm
I am using the hook "function uscj_civicrm_alterContent(  &$content, $context, $tplName, &$object )"  to customize the information on the contact summary screen ( /civicrm/contact/view?action=view&reset=1&cid=13937 )

What would be the best way to retrieve the contact id of the contact being viewed?
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: getting the contact id within hook_civicrm_alterContent
March 04, 2012, 11:00:17 pm
This is how I have done it in another hook:
Code: [Select]
$userID  = $session->get( 'userID' );
You might want to add a check to see if $session is already there, and initialize it is it is not...
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • getting the contact id within hook_civicrm_alterContent

This forum was archived on 2017-11-26.