boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

php code for "logged in as" on blog main page

 
Post new topic   Reply to topic    boardom Forum Index -> PHP help
View previous topic :: View next topic  
Author Message
ghoti



Joined: 27 Jul 2004
Posts: 8

PostPosted: Thu Aug 12, 2004 2:59 pm    Post subject: php code for "logged in as" on blog main page Reply with quote

I'm trying to put a "logged in as user" on my main blog page. I've tried this:
logged in as: <b> <?php the_author() ?> <b/>
and
logged in as: <b> <?php echo $user_login; ?> <b/>

but neither one works.

What am I doing wrong?
Back to top
View user's profile Send private message
sh0ck



Joined: 02 May 2004
Posts: 58
Location: Norway

PostPosted: Thu Aug 12, 2004 4:09 pm    Post subject: Reply with quote

Those values are supposed to be in the b2 loop!. You must fetch the b2 cookie value like this:

add this to b2functions:
Code:

function logintext(){
global $siteurl;
$logincookie = $_COOKIE['cafeloguser'];

if(!isset($_COOKIE['cafeloguser']) || $_COOKIE['cafeloguser'] == '') {
print("you are not logged in");
}
else {
print("you are logged in as ".$logincookie." ");
}
}


then add this function to your blog page:
Code:

<?php logintext(); ?>
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> PHP help All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group