CRM-3301 Contact Checksum token not converted in text email format

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: CiviMail
    • Labels:
      None

      Description

      When sending a CiviMail message and trying to allow non-logged in users to access a profile to update their information, the contact.checksum token does not work in the text format. It does work, however, in HTML format.

      The link created in text format looks something like this: <site root>/sites/all/modules/civicrm/extern/url.php?u=33&qid=26 and when clicked it looks something like:
      <site root>civicrm/profile/edit?reset=1&gid=1&id=3390&

      {contact.checksum}

      But in HTMl format the checksum token is converted perfectly and looks something like this:
      <site root>/civicrm/profile/edit?reset=1&gid=1&id=3390&cs=4306090d027a3bdda4543879170712bc_1215622281_168

      thanks

        Attachments

          Activity

          [CRM-3301] Contact Checksum token not converted in text email format
          Donald A. Lobo added a comment -

          Tony: I just tried this with sandbox and could not reproduce it

          In my experiment it uses the same url record for both the html and text version, here are the relevant urls

          http://localhost/~lobo/drupal6/civicrm/profile/edit?reset=1&gid=1&

          {contact.checksum}
          <a href="http://localhost/~lobo/drupal6/civicrm/profile/edit?reset=1&gid=1&{contact.checksum}

          ">Profile Edit</a>

          and resolves to:

          http://localhost/~lobo/drupal6/sites/all/modules/civicrm/extern/url.php?u=11&qid=1
          <a href='http://localhost/~lobo/drupal6/sites/all/modules/civicrm/extern/url.php?u=11&qid=1'>Profile Edit</a>

          mysql> select * from civicrm_mailing_trackable_url where id = 11 \G;

          I dont think we changed any code in 2.1 for this. can u rerun your experiment

          lobo

          Tony Guzman added a comment -

          Hey Lobo. I was able to reproduce this on 1.9 & 2.0. Here are the exact steps I followed:

          1. CiviMail>>new mailing sending to multiple users with emails i can access.
          2. Entered this exact text in both text and html boxes:
          -------------
          please

          {contact.first_name}

          update your info

          http://demo.dharmatech.org/civicrm/profile/edit?reset=1&gid=1&id=

          {contact.contact_id}

          &

          {contact.checksum}
          ---------------------
          (the profile ID is 1)
          3. Then i logged out of my site.
          In HTML format i get the correct path:
          http://demo.dharmatech.org/civicrm/profile/edit?reset=1&gid=1&id=111&cs=228a3e9b6fdf77bcc651aa29221240b2_1216055702_168

          But in text format, i get a http://demo.dharmatech.org/modules/civicrm/extern/url.php?u=42&qid=42
          which when redirected, goes to this http://demo.dharmatech.org/civicrm/profile/edit?reset=1&gid=1&id=114&{contact.checksum}

          which gives me an error message.

          It seems like in HTML format, CiviMail does not try to rewrite the the link so it "survives" and both tokens are given values. But the text version is rewritten and ultimately fails because the checksum token is not given a value. Jason, my coworker at DharmaTech, thinks the issue has to do with the fact that there are two tokens in the path.

          i reproduced this on our demo site http://demo.dharmatech.org/ (which you can login into if you like. It's running 1.9) and on a 2.0 installation. Does this help troubleshoot?

          Donald A. Lobo added a comment -

          Due to the way the regex' are structured, we only process one token per url. we should extend and generalize this to allow multiple tokens/url

          for the short term (2.1) we'll fix it so

          {contact.checksum}

          generates the token "id=CONTACT_ID&cs=CHECKSUM"

          Donald A. Lobo added a comment -

          Shane:

          Check: http://forum.civicrm.org/index.php/topic,3905.0.html

          for background reading. Basically the second token wont evaluate in a url

          http://localhost/~lobo/drupal6/civicrm/profile/edit?reset=1&gid=1&id=

          {contact.contact_id}&{contact.checksum}
          <a href="http://localhost/~lobo/drupal6/civicrm/profile/edit?reset=1&gid=1&id={contact.contact_id}

          &

          {contact.checksum}

          ">Profile Edit</a>

          the culprit code is at: CRM/Mailing/BAO/Mailing.php, function getDataFunc, line 465

          would be great if u can fix this for 2.1. regex's make my head hurt

          Donald A. Lobo added a comment -


          reverted the previous change and fixed it to allow urls to have multiple tokens

          Neha Kulkarni added a comment -

          Verified in rev 18949

            People

            • Assignee:
              Neha Kulkarni
              Reporter:
              Tony Guzman

              Dates

              • Created:
                Updated:
                Resolved: