0

What is the best (or recommended) way to display related organization information in a profile? I use organizational membership so after registration I have an individual record (with Drupal account) and an organization record (related to the individual).

I use Civi profiles to display stored information to my users. It's easy and straightforward when showing the individual's own data. But a profile that shows the related organization's data is what I'm looking for - right now the profile shows empty fields.

I came up with one solution: if I add id=[org_contact_id] to the profile view url, everything is OK. To get Drupal to generate proper link in menu, I'm planning to use menu hook and through CiviCRM API find user's related organization contact id. It seems complicated though (for such a simple task).

Is there an easier way to do that?

1
  • At this point I managed to do it using hook_menu with argument wildcards and drupal_goto function - it's a bit cleaner version of my idea from the question. It seems to be working fine :) Jun 10, 2019 at 22:00

1 Answer 1

1

Since you are using Drupal would recommend you to build view page by using Views module where you can get organization information of an individual using relationship. This will involve no coding.

If you still want to use Civi Profile than you can over-ride id by using hooks.

Cheers

Pradeep

1
  • I'm using profiles in most of my project and I would like to preserve the look across the system, so I'm stuck with profiles :) Can you please write more on the hooks idea? As I understand I should add id query parameter to the string somewhere at the beginning of the request processing, right? I already tried in hook_init and hook_boot (setting $_GET['id'] to the proper id) but no luck - nothing happens. I don't know much about Drupal programming though :/ Any advice here? Jun 10, 2019 at 20:16

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.