MyBB Community Forums

Full Version: Element hiding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone know how to make an element on a page invisible to people who are logged out and visible to people who are logged in and vice versa?

For example:
<table>
<tr>
<td class=element1>Content seen by Unregistered / Not Logged In, not seen by logged in users</td>
<td class=element2>Content seen by Members (and staff), but not seen by Unregistered / Not Logged In</td>
</tr>
</table>

Pretty much the code describes what I want to do. I want to hide one cell and display another cell.
Hey,
I also need to find out how I would be able to do this, can anyone help?

Thanks in advance,
Lee
In global.php, find:
require_once "./inc/init.php";
After that, add:
if($mybb->user['uid'])
{
    $my_table = "<table>
<tr>
<td class=element2>Content seen by Members (and staff), but not seen by Unregistered / Not Logged In</td>
</tr>
</table>";
}
else
{
    $my_table = "<table>
<tr>
<td class=element1>Content seen by Unregistered / Not Logged In, not seen by logged in users</td>
</tr>
</table>";

In whatever template you want that to show up, add {$my_table}