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) »
  • Anonymous users do not see signup confirmation from custom signup block
Pages: [1]

Author Topic: Anonymous users do not see signup confirmation from custom signup block  (Read 1159 times)

jessehs

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.0.7
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.3
Anonymous users do not see signup confirmation from custom signup block
April 04, 2012, 03:11:09 pm
I've created a signup block as seen at /node/472 of the civicrm dot org site (external links are not allowed, apparently).

Works like a charm!

However, when submitting as an anonymous user, from any page, they do not see the success message, no matter how many times they submit the block.

Here's where it gets interesting: when they visit any path controlled by CiviCRM, like "/civicrm" (resulting in Access Denied), then go back to the block and submit it, they magically start seeing the confirmation message!

It seems obvious that it has to do with setting a browser cookie (since it breaks when I clear cookies).

How can I force Civi set a cookie for anonymous users, even though they don't actually visit a /civicrm page?

Thanks!
Jesse

jessehs

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.0.7
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.3
Re: Anonymous users do not see signup confirmation from custom signup block
April 04, 2012, 03:13:30 pm
Oops, forgot to mention:

Using CiviCRM 4.0.8 with Drupal 7.12.

Page caching is enabled.

jessehs

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.0.7
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.3
Re: Anonymous users do not see signup confirmation from custom signup block
April 04, 2012, 03:50:15 pm
Ah ha. The problem arose due to a change in Drupal 7. Anonymous users do not get sessions by default. I created a custom module and added this code:

<?php

/**
 * Implements hook_init().
 */
function mymodule_base_init() {
  if (!isset($_SESSION['mymodule'])) {
    $_SESSION['mymodule'] = 'session_initialized';
  }
}
?>

It basically forces Drupal to create a session for the anonymous user, and this fixes the problem.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Anonymous users do not see signup confirmation from custom signup block

This forum was archived on 2017-11-26.