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) »
  • {unsubscribeUrl} - page fails as if session support not implemented (but it is)
Pages: [1]

Author Topic: {unsubscribeUrl} - page fails as if session support not implemented (but it is)  (Read 2236 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
{unsubscribeUrl} - page fails as if session support not implemented (but it is)
August 27, 2008, 08:10:40 pm
Version: 2.0.3
Context: A contact who has received a CiviMail email containing a {unsubscribeUrl} token
Action: The contact attempts to unsubscribe via the link
Expected behaviour: The unsubscribe works
Observed behaviour: The following page is shown ...
Quote
Sorry. A non-recoverable error has occurred.

CiviCRM requires session support for Joomla front-end pages. Please modify index.php in the root folder of your front-end Joomla site as described in the step 3 of this CiviCRM documentation page.

Return to home page.
Notes: I've already made the necessary changes to the front end (event registrations work).

Does anyone have any thoughts?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: {unsubscribeUrl} - page fails as if session support not implemented (but it is)
August 27, 2008, 10:25:52 pm

what happens when you use that link as an anon user? does it give you the same error?

When is the error shown? after the user hits confirm? or when loading the unsubscribe page?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

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: {unsubscribeUrl} - page fails as if session support not implemented (but it is)
August 28, 2008, 03:45:20 pm
Lobo,

The problem occurs when an anonymous user presses the "Unsubscribe" button on the Unsubscribe screen (which loads OK).

On further investigation of my CiviMail mailing reports, unsubscribes were working up to about August 14th. Since then I've made 2 changes:
  • created 2 event registration pages
    • Made the change to index.php to support sessions on the front
    • Edited CIVICRM_UF_BASEURL in the front-end civicrm.settings.php to point to my site's front-end rather than back-end URL (because I was getting a similar message (!?))
  • applied the patch for CRM-3384 to allow commas in trackable URLs (Joomla!s search-engine-friendly URLs have this form)

I suspect it's my configuration. I can (triple) check my changes to index.php, and (as a fallback) revert from using action.unsubscribeUrl to action.unsubscribe.

Any suggestions would be greatly appreciated,
Ken

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: {unsubscribeUrl} - page fails as if session support not implemented (but it is)
August 29, 2008, 12:59:38 am

i would do a diff on civicrm.php with your changes on aug 14th. you needed session support for that to work anyway

i dont have too many ideas what might be wrong since the code is different

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

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: {unsubscribeUrl} - page fails as if session support not implemented (but it is)
August 31, 2008, 05:50:40 am
I checked my configuration against the files downloaded with CiviCRM 2.0.3. These are the only differences ...
  • The file administrator/components/com_civicrm/civicrm/civicrm.config.php requires administrator/components/com_civicrm/civicrm.settings.php as set up by the installation process
  • The front-end index.php contains the following additional lines which I added
    Quote
    104a105,108
    > // These lines are needed for proper function of CiviCRM at the frontend
    > session_name( md5( $mosConfig_live_site . '_frontend' ));
    > session_start();
    >
  • The front-end civicrm.settings.php contains: define( 'CIVICRM_UF_BASEURL', 'http://www.citybibleforum.org/' );
  • The administrator civicrm.settings.php contains: define( 'CIVICRM_UF_BASEURL', 'http://www.citybibleforum.org/administrator/' );

pankaj

  • Guest
Re: {unsubscribeUrl} - page fails as if session support not implemented (but it
September 01, 2008, 11:41:29 pm
Hi Ken
I think in <root>components/com_civicrm/civicrm.php
Quote
if ( count( $_SESSION ) <= 1 ) {
            $message = 'CiviCRM requires session support for Joomla front-end pages. Please modify index.php in the root folder of your front-end Joomla site <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Configuring+Front-end+Profile+Listings+and+Forms+in+Joomla%21+Sites">as described in the step 3 of this CiviCRM documentation page</a>.';
            CRM_Core_Error::fatal( $message );
        }

If condition can be changed from '<=' to '<' only.
I'll confirm this and make changes in 2.1 if its ok.

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: {unsubscribeUrl} - page fails as if session support not implemented (but it is)
September 05, 2008, 12:47:47 am
Pankaj,

Thanks for your input.

IMHO, I think the '<=' is correct, and should not be changed. (however, I have no idea about what's appropriate for 2.1 - I'm using 2.0.3)

Summary
I think the issue is that the unsubscribe logic is not storing parameters in the session (unlike event registration, which does). Therefore, when the POST is processed (upon pressing "Unsubscribe") the logic in civicrm.php is only finding 1 variable stored in $_SESSION (for me, that is 'CiviCRM' => [ 'domainId' => 1 ] ).

Detail
  • I reproduced the problem on my laptop
  • I noticed that unsubscribe works after I register for an event, but not otherwise
  • In my debugger, I noticed that $_SESSION contains remnants of the event-registration data when I subsequently unsubscribe, allowing the code to get past the test 'count( $_SESSION ) <= 1'
  • Looking at how CiviCRM uses $_SESSION, I looked for differences between event-registration and unsubscribe ...
  • CRM/Event/Page/EventInfo.php, run(), line 57
    Quote
    $id      = CRM_Utils_Request::retrieve( 'id'    , 'Positive', $this, true );
  • CRM/Mailing/Page/Common.php, run(), line 47
    Quote
    $job_id   = CRM_Utils_Request::retrieve( 'jid', 'Integer', CRM_Core_DAO::$_nullObject );
  • I interpret this to mean that event-registration stores variables from $_GET into $_SESSION (via $this) while unsubscribe does not.
  • I can't explain why my CiviMail mailing reports indicate people were able to unsubscribe using the URL. The code seems to indicate it should never work - is there some condition where the "Unsubscribe" button uses a HTTP GET rather than a POST? (thereby avoiding the 'count( $_SESSION ) <= 1' test)

pankaj

  • Guest
Re: {unsubscribeUrl} - page fails as if session support not implemented (but it
September 08, 2008, 04:58:39 am
We don't use CRM_Utils_Request::retrieve(  ); to store variables from $_GET into $_SESSION.
Check this also http://issues.civicrm.org/jira/browse/CRM-3509 .

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: {unsubscribeUrl} - page fails as if session support not implemented (but it is)
September 08, 2008, 08:19:28 am

Ken:

a few things:

1. Joomla 1.5.x has built in session support for the front end, so that code is not needed anymore

2. we can change the condition to:

if ( ! array_key_exists( 'CiviCRM', $_SESSION ) ) { .... }

I think the above condition is a better more accurate check.

3. Unsubscribe does not use the session (most other front end pages do).  It basically redirects to the same page and sends in all the parameters. Hence it does not store the variables in the session. This was code written very early on and hence does not follow our normal pattern

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • {unsubscribeUrl} - page fails as if session support not implemented (but it is)

This forum was archived on 2017-11-26.