CRM-6948 Opt-Out link in email not generated clean in a Drupal site so configured

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2.3
    • Fix Version/s: 3.3.beta, 4.1.0
    • Component/s: CiviMail
    • Labels:
      None

      Description

      The following is an unsubscribe link generated for a mailing sent 10/11/2010
      http://www.pmicvc.org/index.php?q=civicrm/mailing/unsubscribe&reset=1&jid=380&qid=68728&h=d076decf32668b7c

      My users are getting 'access denied' when attempting to unsubscribe.

        Attachments

          Activity

          [CRM-6948] Opt-Out link in email not generated clean in a Drupal site so configured
          Donald A. Lobo added a comment -


          please discuss on forums. this is a permisisoning issue

          James Robbins added a comment -

          How is an unclean generated url a permissioning issue?

          James Robbins added a comment -

          I have just enabled "access CiviMail subscribe/unsubscribe pages" for anonymous users. It does seem unproductive to have that as a permissioned item in CiviCRM, since the only way to reach it would be via an opt-out link sent by CiviCRM. Or, perhaps I am misunderstanding that particular permission.

          Donald A. Lobo added a comment -


          we should find and fix the non clean-url issue

          Piotr Szotkowski added a comment -

          I tried hard to replicate this, but can't; in my setup the opt-out and unsubscribe URLs are generated properly (i.e., they're 'clean' URLs). Is there a simple way to reproduce it?

          Pushing to 3.3.beta for now

          Donald A. Lobo added a comment -

          james:

          what version are u running?

          In 3.2 we bootstrap drupal and hence know if clean urls are enabled or not. In 3.1 and prior we did not have this info and hence all urls were generated in the regular format, i.e. unclean

          Donald A. Lobo added a comment -


          Suspect this was fixed in 3.2 when we started bootstrapping drupal

          Eileen McNaughton added a comment -

          re-opening for Tim as he CAn reproduce

          Tim Otten added a comment -

          The cleanurl behavior is detected in civicrm.settings.php with this test:

          ------------
          if ( function_exists( 'variable_get' ) && variable_get('clean_url', '0') != '0' ) {
          define( 'CIVICRM_CLEANURL', 1 );
          } else {
          define( 'CIVICRM_CLEANURL', 0 );
          }
          ------------

          The test works correctly in the normal case where Drupal bootstraps before CiviCRM (i.e. Drupal... -> civicrm_initialize... -> require civicrm.settings.php). However, when CiviCRM bootstraps before Drupal, the 'variable_get' function is undefined at the critical moment, so the test determines that cleanurl is unavailable. This most likely causes failures in all cron scripts.

          There is probably some clean solution which involves moving the test logic from civicrm.settings.php to some part of CRM/Utils/System/Drupal.php where the availability of variable_get can be assured. It's not obvious to me where that is. In lieu of that, the attached patch adds an extra instruction to loadBootstrap which refreshes cleanURL.

          Aside: This bug would not be reproduced when using, say, CiviMail's "Preview" feature (or "Send test mailing" – but I didn't test) because that uses the standard Drupal->CiviCRM bootstrapping. To reproduce, one must actually invoke the cron script in the documented fashion.

            People

            • Assignee:
              Piotr Szotkowski
              Reporter:
              James Robbins

              Dates

              • Created:
                Updated:
                Resolved: