Front Page
Hi Guys
I'm having headaches getting around this issue. I created a module to handle the how my home page is displayed. Its has two sides to it. It either displays one side when a user is logged in and another thing when users are not logged in. Im using d6 to point it to the module as per example http://drupal.org/node/22237 from http://127.0.0.1/mysite/?q=admin/settings/site-information
function homepage_default() {
global $user;
if ($user->uid) {
$output .= t('Welcome To My Site '. $user->name .' The time is );
return $output;
unset($output);
}
else {
$output .= t('To Login Please go to http://www.mysite.co.za/?q=user');
}
return $output;
unset($output);
}
Now the problem I'm having is when a users registers which requires email verification no message is displayed and just goes to the else.
Please offer help if you have encountered a problem like this. I cannot use the front page module as this page has allot of custom internal applications depended on it.
Thanks in advance

...
try this
<?phpfunction homepage_default() {
global $user;
if ($user->uid) { // if the user is logged in
$output = t('Welcome To My Site '. $user->name .' The time is' );}
if (!$user->uid) { // if the user is not logged in
$output = t('To Login Please go to <a href="http://www.mysite.co.za/?q=user'" title="http://www.mysite.co.za/?q=user'" rel="nofollow">http://www.mysite.co.za/?q=user'</a>);}
print $output;
}
?>
Still Wont work
Its still doesn't work. Print escapes the theme and it still won't display status messages if I use return $output.
:-(
In Open Source I Trust! Everybody Else Must Pay Cash!
..
change the 2nd last line to this:
<?phpprint theme('page', $output);
?>
the theme function should pick up the status messages for you.
Still Doesn't Work
Ive tried this and other things and its still doesn't work. The funny thing is that when I disable the Require e-mail verification when a visitor creates an account check box its works. So my question is what do you set the global $user variable to if a user is registered and not verified?
In Open Source I Trust! Everybody Else Must Pay Cash!
cache problems
if you disable require email verification, that means the user is automatically registered and has a
$user->id.you might need to add an exclude from cache call in your module....I've read that drupal 6 has some caching issues that might be why your module sometimes works and sometimes doesn't. In other words, it's working, but the drupal 6.0 is spitting out a cached page, as opposed to a dynamic page.
A couple of suggestions
A couple of suggestions (from a complete noob, so apologies if you know already they wouldn't work):
1)
Would the login destination module help? http://drupal.org/project/login_destination
2)
The first way I would try to tackle this is to:
- Create a region called 'content_top' in my theme (you might already even have one)
- Create the front page. Eg. node/1 but with no content in it, and set drupal to load it for everyone.
- Create a block & put it in content_top. Set it to appear for 'anon' and only node/1.
Create your message for guests in this block
- Create a block & put it in content_top. Set it to appear for 'auth' and only node/1.
Create your message for auth users in this block.
- This also gives you the option of using the 'content' area of the page too, to give a message to
both aona and auth users if you wished.
This way you're not making drupal do anything 'unusual', just using what's already there.
Please post back if you figure out an elegant solution; I might have to do this myself on my own site
at some point.
Cheers.