I have developped an external php program to generate a customized contact data-sheet (pdf).

This program must be run from a Civi Page via an URL which requires the current Contact_id as an argument, in the following way :

https://www.mysite.com/fpdf/myprogram.php?contact=current contact id

How can I get and must I parameterize this current contact id ?

As an alternative, I could use the Current Drupal User-Id instead of the Civi Contact-Id (the user is supposed to be authenticated, and I know how to convert user to contact)


Another is convert your external program to an extension, then make api calls.


Extention is probably the best and right way to do it : I have seen that the API is able to get the Contact Id.

I have to learn how to make an Extension.

Thanks to all of you for your answers


One way is use a drupal view with a field with the link in it since you can access user id from view fields. Make it a block if you need it to be on a specific page.

  • Agreed. and if you were going this route, you could even have Views produce the PDF but that isn't what the question asks about, but just noting here for posterity
    – petednz - fuzion
    Jul 4 '16 at 6:47

If you developed an external program I would highly recommend you to put this in a CiviCRM extension. How are you accessing your program? You could easily add a button or link to the page with your extension which then includes the contact_id?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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