Re: Check if a user is logged in?
The code above handles both cases, you’re logged in or you’re logged out. There is no in between. If one is true, the other is false.
<?php
if ( bb_is_user_logged_in() ) {
echo "No ads for you!n";
}
else {
echo "Here is an ad, buy now!n";
}
?>
You could also just check to see if they’re not logged in like this:
<?php
if ( !bb_is_user_logged_in() ) {
echo "Here is an ad, buy now!n";
}
?>
The exclamation in front of the function says “if this is NOT true, then the if statement is true; continue.)