2

I have a CiviCRM contribution page that allows an individual to renew a membership on behalf of an organization. When we email them from CiviMail with a checksum link to the page, it will prefill their information in the form automatically and have the membership renewal associate correctly to the organization.

How can I pull the organizational information into a custom Drupal module (e.g. a block that displays in the sidebar, for example)? I would like to have a text block that displays some information about the org and potentially names of people who are related to the org by relationships in CiviCRM. I won't have a problem doing that with Views and/or the CiviCRM API in a custom Drupal module, but I'm not sure how to get the org's ID in this scenario, to know which info to display.

1 Answer 1

2

I am assuming you want to show the organization information of logged in contact. So I would do following:

  1. Get the contact id of logged in contact (or anonymous user who used a checksum link, via the cid field in the URL, as @petednz noted).
  2. Get the current employer id
  3. then retrieve address of current employer
2
  • 1
    Since you are using a checksum, drupal considers the current user is 'anonymous'. So for any Views block using 'current user' for the contextual filter won't work. But the checksum url does provide the id=xx so a bit of php in your Views contextual filter could get you what you need Dec 13, 2014 at 23:31
  • Thanks, both. The anonymous user case was what I was stumped on, and I've expanded that issue in a followup question: drupal.stackexchange.com/questions/140841/…
    – Laryn
    Dec 15, 2014 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.