On my site, I show a MailChimp Subscription Form block on two different pages.
Drupal cache is enabled. When I submit one of the forms, Drupal always redirects to the form page I visited first. This is probably because the blocks are cached per user.

Because this can cause users to be redirected away from their current page without warning, this can be very confusing and can lead to a bad user experience.

Comments

levelos’s picture

Status: Active » Closed (duplicate)
danielphenry’s picture

Version: 7.x-1.0 » 7.x-2.x-dev
Component: User interface » Lists
Issue summary: View changes
Status: Closed (duplicate) » Needs work

Duplicate of what?

I'm seeing this issue as well. Accept for anonymous user they all are the same user. So whoever the first person to see the site is after a cache flush everyone is redirected to that page after submission. Kind of a big deal. Need to switch cache to Per page or just no cache at all since that would cause conflict on logged in users.

danielphenry’s picture

poor mans solution is to use both per page and per user.

/**
 * Implements hook_block_info().
 */
function mailchimp_lists_block_info() {
  $blocks = array();
  $lists = mailchimp_lists_load_multiple_by_name();
  foreach ($lists as $name => $list) {
    $blocks[$name] = array(
      'info' => t('Mailchimp Subscription Form: @name', array('@name' => $list->label())),
      'cache' => DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_USER,
    );
  }

  return $blocks;
}

However per user is inefficent by itself. caching the block on every page for every user is a nightmare for the cache table. Custom solution would probaly be better.

Cache the authenticated users per user and anonymous per page. Would need to implement your own cache pulls in bock_view.

Jason Dean’s picture

Experiencing the same problem with subscription blocks. Anonymous users are subscribed, but get sent to an apparently random page (due to whatever was last cached).

This is a significant problem for user experience, as the original poster said (back in 2011!).

drikc’s picture

Same block caching use (DRUPAL_CACHE_PER_USER) on 3.x version which render the same issue.

Following up commet #3, by using DRUPAL_CACHE_PER_ROLE instead of DRUPAL_CACHE_PER_USER it should reduce the cache table entries:

'cache' => DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE
amytswan’s picture

Status: Needs work » Closed (won't fix)

“And now our watch [for support of the 7.x-2.x version of the MailChimp module] has ended…” With the approaching deprecation of MailChimp’s API version 2.0, I’m sad to say we too must turn the page. This branch will become unsupported in early October and officially deprecated by the end of this year (2016).

Fret not! The 7.x-4.x and 8.x versions come highly recommended. Both are using Mailchimp’s new API 3.0 and are being actively maintained. If you find this issue still exists on either the 7.x-4.x or 8.x branches, let us know by opening a new ticket. “What is dead may never die, but rises again, harder and stronger!”