CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
Pages: [1]

Author Topic: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php  (Read 2435 times)

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 16, 2011, 06:10:06 am
In 3.4.2, when I embed a permalink in an email, as well as a click-through URL, I get the following behaviour:

In my email client, the click-through URL has the following form ...
Quote
https://www.example.com/sites/all/modules/civicrm/extern/url.php?u=9999&qid=999999

When I click on the permalink, I see the HTML message in a browser at the address ...
Quote
https://www.example.com/civicrm/mailing/view?reset=1&id=999

In the browser, the click-through URL is missing the 'qid' parameter and clicking on it gives a "Missing input parameters" error ...
Quote
https://www.example.com/sites/all/modules/civicrm/extern/url.php?u=9999&qid=

I suggest that the logic of url.php be changed so that if qid is missing is still displays the link. If that causes issues (eg, profiles can't be filled with user data) then I suggest that the 'qid' argument is added to /civicrm/mailing/view so it can be added to the click-through URLs.

Ken

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 16, 2011, 11:04:42 am
This might be related: http://issues.civicrm.org/jira/browse/CRM-8298

Kurund
Found this reply helpful? Support CiviCRM

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 16, 2011, 02:36:15 pm
Kurund,

I don't think so. I can see the permalink page fine. It is the click-through links (handled by /civicrm/extern/url.php) which are having the problem.

I'm unable to reproduce this on the demo as "the default mailbox has not been defined".

Ken

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 16, 2011, 05:52:54 pm
Some further information.

Relative links on my site are OK ("/civicrm/event/view....")

Absolute links fail ("http://www.google.com/...." and "http://example.com/civicrm/event/view/....")

Ken
« Last Edit: June 16, 2011, 06:12:56 pm by ken »

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 16, 2011, 07:12:55 pm
A possible solution would be allow the URL to be returned even if 'qid' is absent. Thus, extern/url.php is modified to only check if the $url_id is set ...
Code: [Select]
--- unit.citybibleforum.local/modules/civicrm/extern/url.php    2011-05-02 11:19:28.276646999 +1000
+++ all/modules/civicrm/extern/url.php  2011-06-17 12:03:26.905796481 +1000
@@ -16,8 +16,7 @@
 }
 $url_id = CRM_Utils_Array::value( 'u', $_GET );
 
-if ( ! $queue_id ||
-     ! $url_id ) {
+if ( ! $url_id ) {
     echo "Missing input parameters\n";
     exit( );
 }

... allowing $queue_id to be unset. Then the CRM/Mailing/Event/BAO/TrackableURLOpen.php's track() function could be modified to use a simpler query when there is no $queue_id, and also to skip the recording of the tracking event ...
Code: [Select]
--- unit.citybibleforum.local/modules/civicrm/CRM/Mailing/Event/BAO/TrackableURLOpen.php        2011-05-02 11:18:22.976551226 +1000
+++ all/modules/civicrm/CRM/Mailing/Event/BAO/TrackableURLOpen.php      2011-06-17 12:03:23.915792101 +1000
@@ -70,25 +70,35 @@
         $eq = CRM_Mailing_Event_BAO_Queue::getTableName();
         $turl = CRM_Mailing_BAO_TrackableURL::getTableName();
         
-        $search->query("SELECT $turl.url as url from $turl
+        if ( !$queue_id ) {
+               $search->query("SELECT $turl.url as url from $turl
+                    WHERE $turl.id = "
+                        . CRM_Utils_Type::escape($url_id, 'Integer')
+               );
+        } else {
+               $search->query("SELECT $turl.url as url from $turl
                     INNER JOIN $job ON $turl.mailing_id = $job.mailing_id
                     INNER JOIN $eq ON $job.id = $eq.job_id
                     WHERE $eq.id = "
                         . CRM_Utils_Type::escape($queue_id, 'Integer')
                 . " AND $turl.id = "
                         . CRM_Utils_Type::escape($url_id, 'Integer')
-        );                                                                                                                                                 
+               );                                                                                                                                           
+        }                                                                                                                                                   
+                                                                                                                                                           
                                                                                                                                                             
         if (! $search->fetch()) {                                                                                                                           
             /* Whoops, error, don't track it.  Return the base url. */                                                                                     
             return CRM_Utils_System::baseURL();
         }                                                                                                                                                   
                                                                                                                                                             
-        $open = new CRM_Mailing_Event_BAO_TrackableURLOpen();                                                                                               
-        $open->event_queue_id = $queue_id;                                                                                                                 
-        $open->trackable_url_id = $url_id;                                                                                                                 
-        $open->time_stamp = date('YmdHis');                                                                                                                 
-        $open->save();                                                                                                                                     
+        if ( $queue_id ) {
+               $open = new CRM_Mailing_Event_BAO_TrackableURLOpen();
+               $open->event_queue_id = $queue_id;
+               $open->trackable_url_id = $url_id;
+               $open->time_stamp = date('YmdHis');
+               $open->save();
+        }
 
         return $search->url;
     }

I have tested this and it seems OK.
« Last Edit: June 17, 2011, 06:29:47 pm by ken »

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 16, 2011, 09:21:14 pm
Can you file an issue for this in jira

Thanks
Kurund
Found this reply helpful? Support CiviCRM

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 17, 2011, 06:16:43 pm
Created issue CRM-8328

Upon further thought, there are 2 solution options: to get civicrm/extern/url.php to work without the 'qid' parameter; or to somehow supply it. The permalink pages can be made publicly visible, so 'qid' may not be supplied in that case.

I guess we can have both options
  • apply a fix like the one I suggested above
  • add a 'qid' parameter to the permalink URL in the CiviMail, so civicrm/mailing/view can create a page where each of the civicrm/extern/url.php links has the 'qid' parameter

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 17, 2011, 06:30:59 pm
I tested my fix, and have fixed it. It works. I'll attach patch files to the issue.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php
June 20, 2011, 02:44:16 am
Thanks for the patch

Kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • CiviMail permalink gives "Missing input parameters" on civicrm/extern/url.php

This forum was archived on 2017-11-26.