I'm printing error messages (e.g. from the login form) in my page with <?php print $messages; ?>
. Nothing is showing up.
I think my problem is that the $_SESSION variable (which should contain these error messages) is empty.
I tried explicitly setting a session var in my page with $_SESSION['test'] = 'wtf';
, which definitely inserted something into my drupal_sessions table:
mysql> SELECT * FROM drupal_sessions;
+-----+----------------------------+-------------+------------+-------+------------------+
| uid | sid | hostname | timestamp | cache | session |
+-----+----------------------------+-------------+------------+-------+------------------+
| 0 | 6oq6700jo1guhe89bue0kj8jl6 | 10.16.0.132 | 1311836508 | 0 | test|s:3:"wtf"; |
+-----+----------------------------+-------------+------------+-------+------------------+
Then I added a hook_init()
which did nothing except print_r($_SESSION); die;
. This printed out Array ( )
, i.e. an empty $_SESSION array.
So either Drupal isn't reading into the $_SESSION variable properly, or something somewhere in my site (maybe my code) is resetting the $_SESSION variable. I really need to track this down — where should I start looking? Is there an obvious way to try and debug this?
login.inc
<div id="login">
<?php print $messages; ?>
<?php if ($user->uid) { ?>
<p>You are already logged in as <span id="username"><?php print $user->name; ?></span>.</p>
<p>Would you like to <a href="/logout/">log out</a>?</p>
<?php } else {
print drupal_get_form('user_login_block');
$connector_block = (object) module_invoke('connector', 'block', 'view', 0);
$connector_block->module = 'connector';
$connector_block->delta = 'one_click_block';
print theme('block', $connector_block);
print fbconnect_render_button();
} ?>
</div>
init hook
function mr_misc_hooks_init() {
print_r($_SESSION);
die;
}