Skip to main content
added 1125 characters in body
Source Link
HomoTechsual
  • 1.1k
  • 5
  • 18

In the Event self-service update form referenced in your link the URL fragment "PID" refers to the Participant ID (as correctly identified by Pradeep Nayak).

The mechanism for obtaining this and other information in a Smarty tag can be achieved using the CiviCRM API within Smarty as outlined in the docs here: https://docs.civicrm.org/dev/en/latest/api/usage/#smarty

The built-in API Explorer can assist in determining how to retrieve the information you require from the API and provides Smarty code for your use based on the queries you build.

The code for the "selfsvcupdate" form is here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Event/Form/SelfSvcUpdate.php. See Line 216 for a direct link to the retrieval and lookup of the PID value from the URL.

APIv3Generic Example

{crmAPI var='result' entity='Participant' action='get' event_id=9 contact_id="user_contact_id"}
{foreach from=$result.values item=participant}
  {$participant.id}
{/foreach}

The code above will retrieve participant ID for the event with ID 9 for the currently logged in user.

Scheduled Reminder Example

Scheduled reminders are missing the necessary tokens to make this easy - after a bit of experimentation this code works - but it may be a bit fragile. It is however portable (limited static information, no hardcoded IDs)!

{capture assign=eventID}{event.event_id}{/capture}

 Event ID = {$eventID}<br /> // DEBUG Statement - DO NOT USE IN PROD

{capture assign=contactID}{contact.contact_id}{/capture}

 Contact ID = {$contactID}<br /> // DEBUG Statement - DO NOT USE IN PROD

{capture assign=participantID}{crmAPI var='result' entity='Participant' action='get' event_id=`$eventID` contact_id=`$contactID`}{$result.id}{/capture} 

Participant ID = {$participantID}<br/> // DEBUG Statement - DO NOT USE IN PROD

{if $participantID}
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participantID`&{contact.checksum}"  h=0 a=1 fe=1}{/capture}
{/if}

{if $selfService }
<a href="{$selfService}">{ts}Click here to manage your registration.{/ts}</a>
{/if}

In the Event self-service update form referenced in your link the URL fragment "PID" refers to the Participant ID (as correctly identified by Pradeep Nayak).

The mechanism for obtaining this and other information in a Smarty tag can be achieved using the CiviCRM API within Smarty as outlined in the docs here: https://docs.civicrm.org/dev/en/latest/api/usage/#smarty

The built-in API Explorer can assist in determining how to retrieve the information you require from the API and provides Smarty code for your use based on the queries you build.

The code for the "selfsvcupdate" form is here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Event/Form/SelfSvcUpdate.php. See Line 216 for a direct link to the retrieval and lookup of the PID value from the URL.

APIv3 Example

{crmAPI var='result' entity='Participant' action='get' event_id=9 contact_id="user_contact_id"}
{foreach from=$result.values item=participant}
  {$participant.id}
{/foreach}

The code above will retrieve participant ID for the event with ID 9 for the currently logged in user.

In the Event self-service update form referenced in your link the URL fragment "PID" refers to the Participant ID (as correctly identified by Pradeep Nayak).

The mechanism for obtaining this and other information in a Smarty tag can be achieved using the CiviCRM API within Smarty as outlined in the docs here: https://docs.civicrm.org/dev/en/latest/api/usage/#smarty

The built-in API Explorer can assist in determining how to retrieve the information you require from the API and provides Smarty code for your use based on the queries you build.

The code for the "selfsvcupdate" form is here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Event/Form/SelfSvcUpdate.php. See Line 216 for a direct link to the retrieval and lookup of the PID value from the URL.

Generic Example

{crmAPI var='result' entity='Participant' action='get' event_id=9 contact_id="user_contact_id"}
{foreach from=$result.values item=participant}
  {$participant.id}
{/foreach}

The code above will retrieve participant ID for the event with ID 9 for the currently logged in user.

Scheduled Reminder Example

Scheduled reminders are missing the necessary tokens to make this easy - after a bit of experimentation this code works - but it may be a bit fragile. It is however portable (limited static information, no hardcoded IDs)!

{capture assign=eventID}{event.event_id}{/capture}

 Event ID = {$eventID}<br /> // DEBUG Statement - DO NOT USE IN PROD

{capture assign=contactID}{contact.contact_id}{/capture}

 Contact ID = {$contactID}<br /> // DEBUG Statement - DO NOT USE IN PROD

{capture assign=participantID}{crmAPI var='result' entity='Participant' action='get' event_id=`$eventID` contact_id=`$contactID`}{$result.id}{/capture} 

Participant ID = {$participantID}<br/> // DEBUG Statement - DO NOT USE IN PROD

{if $participantID}
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participantID`&{contact.checksum}"  h=0 a=1 fe=1}{/capture}
{/if}

{if $selfService }
<a href="{$selfService}">{ts}Click here to manage your registration.{/ts}</a>
{/if}
added 324 characters in body
Source Link
HomoTechsual
  • 1.1k
  • 5
  • 18

In the Event self-service update form referenced in your link the URL fragment "PID" refers to the Participant ID (as correctly identified by Pradeep Nayak).

The mechanism for obtaining this and other information in a Smarty tag can be achieved using the CiviCRM API within Smarty as outlined in the docs here: https://docs.civicrm.org/dev/en/latest/api/usage/#smarty

The built-in API Explorer can assist in determining how to retrieve the information you require from the API and provides Smarty code for your use based on the queries you build.

The code for the "selfsvcupdate" form is here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Event/Form/SelfSvcUpdate.php. See Line 216 for a direct link to the retrieval and lookup of the PID value from the URL.

APIv3 Example

{crmAPI var='result' entity='Participant' action='get' event_id=9 contact_id="user_contact_id"}
{foreach from=$result.values item=participant}
  {$participant.id}
{/foreach}

The code above will retrieve participant ID for the event with ID 9 for the currently logged in user.

In the Event self-service update form referenced in your link the URL fragment "PID" refers to the Participant ID (as correctly identified by Pradeep Nayak).

The mechanism for obtaining this and other information in a Smarty tag can be achieved using the CiviCRM API within Smarty as outlined in the docs here: https://docs.civicrm.org/dev/en/latest/api/usage/#smarty

The built-in API Explorer can assist in determining how to retrieve the information you require from the API and provides Smarty code for your use based on the queries you build.

The code for the "selfsvcupdate" form is here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Event/Form/SelfSvcUpdate.php. See Line 216 for a direct link to the retrieval and lookup of the PID value from the URL.

In the Event self-service update form referenced in your link the URL fragment "PID" refers to the Participant ID (as correctly identified by Pradeep Nayak).

The mechanism for obtaining this and other information in a Smarty tag can be achieved using the CiviCRM API within Smarty as outlined in the docs here: https://docs.civicrm.org/dev/en/latest/api/usage/#smarty

The built-in API Explorer can assist in determining how to retrieve the information you require from the API and provides Smarty code for your use based on the queries you build.

The code for the "selfsvcupdate" form is here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Event/Form/SelfSvcUpdate.php. See Line 216 for a direct link to the retrieval and lookup of the PID value from the URL.

APIv3 Example

{crmAPI var='result' entity='Participant' action='get' event_id=9 contact_id="user_contact_id"}
{foreach from=$result.values item=participant}
  {$participant.id}
{/foreach}

The code above will retrieve participant ID for the event with ID 9 for the currently logged in user.

Source Link
HomoTechsual
  • 1.1k
  • 5
  • 18

In the Event self-service update form referenced in your link the URL fragment "PID" refers to the Participant ID (as correctly identified by Pradeep Nayak).

The mechanism for obtaining this and other information in a Smarty tag can be achieved using the CiviCRM API within Smarty as outlined in the docs here: https://docs.civicrm.org/dev/en/latest/api/usage/#smarty

The built-in API Explorer can assist in determining how to retrieve the information you require from the API and provides Smarty code for your use based on the queries you build.

The code for the "selfsvcupdate" form is here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Event/Form/SelfSvcUpdate.php. See Line 216 for a direct link to the retrieval and lookup of the PID value from the URL.