Have a question about CiviCRM? Get it answered quickly at the new CiviCRM Stack Exchange Q+A siteThis forum was archived on 25 November 2017. Learn more.How to get involved.What to do if you think you've found a bug.
The functionality is supposed to work for anonymous user for a limited time period (1 week)
<a href="http://example.com/civicrm/profile/edit?reset=1&gid=1&{contact.checksum}">here</a>
<a href="http://example.com/sites/all/modules/civicrm/extern/href=%22http://example.com/civicrm/profile/edit?reset=1&gid=1&cs=82040e6e5e0ed56201080d2e6e66a9da_1220440559_168">here</a>
} else if ( $token == 'checksum' ) { $cs = CRM_Contact_BAO_Contact::generateChecksum( $contact['contact_id'] ); $value = "cs={$cs}"; } else {
if ( ( preg_match('/^href/i',$token) || preg_match('/^http/i',$token) ) && $this->url_tracking ) { // it is a url so we need to check to see if there are any tokens embedded // if so then call this function again to get the token dataFunc // and assign the type 'embedded' so that the data retrieving function // will know what how to handle this token. if ( preg_match_all('/(\{\w+\.\w+\})/', $token, $matches) ) { $funcStruct['type'] = 'embedded_url'; $funcStruct['embed_parts'] = $funcStruct['token'] = array( ); foreach ( $matches[1] as $match ) { $preg_token = '/'.preg_quote($match,'/').'/'; $list = preg_split($preg_token,$token,2); $funcStruct['embed_parts'][] = $list[0]; $token = $list[1]; $funcStruct['token'][] = $this->getDataFunc($match); } } else { $funcStruct['type'] = 'url'; } } else // ...
private function getTokenData(&$token_a, $html = false, &$contact, &$verp, &$urls, $event_queue_id) { $type = $token_a['type']; $token = $token_a['token']; $data = $token; if ($type == 'embedded_url') {// $embed_data = $this->getTokenData($token, $html = false, $contact, $verp, $urls, $event_queue_id);// $url = join($token_a['embed_parts'],$embed_data); $embed_data = array( ); foreach ( $token as $t ) { $embed_data[] = $this->getTokenData($t, $html = false, $contact, $verp, $urls, $event_queue_id); } $numSlices = count( $embed_data ); $url = ''; for ( $i = 0; $i < $numSlices; $i++ ) { $url .= "{$token_a['embed_parts'][$i]}{$embed_data[$i]}"; } if ( isset( $token_a['embed_parts'][$numSlices] ) ) { $url .= $token_a['embed_parts'][$numSlices]; } $data = CRM_Mailing_BAO_TrackableURL::getTrackerURL($url, $this->id, $event_queue_id); } else if ( $type == 'url' ) { $data = CRM_Mailing_BAO_TrackableURL::getTrackerURL($token, $this->id, $event_queue_id); } else if ( $type == 'contact' ) { $data = CRM_Utils_Token::getContactTokenReplacement($token, $contact); } else if ( $type == 'action' ) { $data = CRM_Utils_Token::getActionTokenReplacement($token, $verp, $urls, $html); } return $data; }
So the bug is with having two tokens in a URL . It did not work for me in either html or text mode. The regex's there are a bit hairy and i'm punting the issue to 2.2however for 2.1, i've expanded the {contact.checksum} token to include both the contact id and the checksum, since checksum needs the contact id.