Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9272789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:56:54+00:00 2026-06-18T15:56:54+00:00

I have an external non-Drupal website members.example.com that sets a cookie if the audience

  • 0

I have an external non-Drupal website members.example.com that sets a cookie if the audience member logs in on that site. It sets a cookie that is visible to the Drupal site that is:

$_COOKIE[‘name’] = ‘John Smith’;

I want to recognize that the members.example.com logged-in user has access to premium content on the Drupal site at http://www.example.com. I also want to great the logged-in member by name in the eyebrow section of the website.

The issue is, that after logging in the non-Drupal site members.example.com, and returning to the Drupal site http://www.example.com, Drupal is still caching a lot of stuff and doesn’t recognize that the user now has the $_COOKIE[‘name’] set.

I have:

Set the cookie domain in settings.php to ‘example.com’

Tried to bust the cache for anonymous Drupal users who also have the cookie this:

 /**
  * Implements hook_init()
  */
function caplogin_init() {

  // Check for cookie if it's set to 'loggedout':
  if (isset($_COOKIE['name'])) {
    if (strpos($_COOKIE['name'],'loggedout') !== FALSE) {
      // Log them out on the www site too:
      setcookie('name', '', 1, '/', '.example.com');
      global $user;
      if ($user->uid > 0) {
        user_logout();
      }
      $reason = 'Members server logout.';
      _caplogin_no_cache($reason);
      drupal_set_message(t('You have been logged out of the site. Thanks for visiting!'));
    }
    else {
      $reason = 'Member logged in internal server.';
      _caplogin_no_cache($reason);
    }
  }
}

and…

function _caplogin_no_cache($reason) {
    if (!$reason) {
      $reason = 'no-cache called by site functionality.';
    }
    drupal_add_http_header('X-DRCC-No-Cache-Reason', $reason);
    drupal_add_http_header('Pragma', 'no-cache');
    drupal_add_http_header('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');
    drupal_add_http_header('Cache-Control', 'no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
    drupal_add_http_header('Expires', 'Sat, 02 Jan 1971 00:00:00 GMT');
 }

I have also installed Devel module and (for testing) checked the ON checkbox for rebuilding the theme cache on every page load. No luck.

If you add a bogus query string it DOES bust the cache, e.g. http://www.example.com/?sdjaSDH

But the client needs the functionality where Drupal recognizes that the user has logged in the external members.example.com site.

What else can I try?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:56:55+00:00Added an answer on June 18, 2026 at 3:56 pm

    does this

    $GLOBALS['conf']['cache'] = FALSE; 
    

    help ?

    You might need to add this code to hook_boot() or hook_init() with some switches of your desire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have external proofreaders to work directly inside my Drupal site.
I have some PHP scripts that are accessed by external non human sources. Normally
I have a non-Drupal site which authenticates with a simple MySQL user database. I
I have a need to build views in drupal of non-nodes, actually objects external
I have external html5 canvas that you can paint on some lines using your
I have an external device that spits out UDP packets of binary data and
I have a external xxxx.js file where its contents are in non-understandable format. Eg:
We have an external service that is currently accessible via the http (port 80,
I have an external SWF that I load into a Loader object. I add
We have a third-party external web page on another domain that we're loading in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.