How do I show different content to logged in users

15 years 1 month ago #93367 by alex8807
So I want a small part of my page to change if a user logs in. By default I want one piece of code to be shown and after the user logs in, I want it to change.

I tried this:[code:1]<?php
global $_CB_framework;
$myId = $_CB_framework->myId();
if ( $myId ) {
echo "<div class='if-example'>This is an example!</div>";
}
else {
echo "<div class='else-example'>This is also an example</div>";
}
?>[/code:1]

But I got

Fatal error: Call to a member function myId() on a non-object in /home/*****/public_html/templates/default/index.php on line 58


So what do I do??

Please Log in to join the conversation.

15 years 1 month ago #93512 by NeroInferno
Can't you redirect the user into a custom page after logged? there's a parameter to make this in CB if i remember well.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.157 seconds

Facebook Twitter LinkedIn