MrSamCraft Posted March 12, 2013 Share Posted March 12, 2013 Hello, Iv finished my login/register function now! wooop! But i am wanting to remove the register/login menu from registered users now, how would I go about doing this? Thanks! This is the menu code from the index page! <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="brand">EnderBase</a> <div class="nav-collapse collapse"> <ul class="nav"> <li class="active"><a>Home</a></li> <li><a href="http://enderbase.com/about.php">About</a></li> <li><a href="http://enderbase.com/contact.php">Contact</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Register/Login <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="http://enderbase.com/register.php">Register</a></li> <li><a href="http://enderbase.com/login.php">Login</a></li> <li class="divider"></li> <li><a href="http://enderbase.com/activate.php">Account Activation</a></li> </ul> </li> </ul> </div><!--/.nav-collapse --> </div> </div> </div> Quote Link to comment https://forums.phpfreaks.com/topic/275571-how-can-i-hide-a-menu-item-from-a-registered-user/ Share on other sites More sharing options...
jcbones Posted March 12, 2013 Share Posted March 12, 2013 <?php if(!user_registerd) { //if user is not registered echo $link; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/275571-how-can-i-hide-a-menu-item-from-a-registered-user/#findComment-1418270 Share on other sites More sharing options...
MrSamCraft Posted March 13, 2013 Author Share Posted March 13, 2013 (edited) wouldn't i use this instead? <?php if(logged_in() == false) { ?> STUFF TO HIDE HERE <?php } else { ?> Edited March 13, 2013 by MrSamCraft Quote Link to comment https://forums.phpfreaks.com/topic/275571-how-can-i-hide-a-menu-item-from-a-registered-user/#findComment-1418316 Share on other sites More sharing options...
yomanny Posted March 13, 2013 Share Posted March 13, 2013 When you're printing out the menu, you could throw in an if, just like jcbones suggested: <ul class="nav"> <li class="active"><a>Home</a></li> <li><a href="http://enderbase.com/about.php">About</a></li> <li><a href="http://enderbase.com/contact.php">Contact</a></li> <?php if(!logged_in()) { ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Register/Login <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="http://enderbase.com/register.php">Register</a></li> <li><a href="http://enderbase.com/login.php">Login</a></li> <li class="divider"></li> <li><a href="http://enderbase.com/activate.php">Account Activation</a></li> </ul> </li> <?php } ?> </ul> - W Quote Link to comment https://forums.phpfreaks.com/topic/275571-how-can-i-hide-a-menu-item-from-a-registered-user/#findComment-1418317 Share on other sites More sharing options...
MrSamCraft Posted March 13, 2013 Author Share Posted March 13, 2013 When you're printing out the menu, you could throw in an if, just like jcbones suggested: <ul class="nav"> <li class="active"><a>Home</a></li> <li><a href="http://enderbase.com/about.php">About</a></li> <li><a href="http://enderbase.com/contact.php">Contact</a></li> <?php if(!logged_in()) { ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Register/Login <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="http://enderbase.com/register.php">Register</a></li> <li><a href="http://enderbase.com/login.php">Login</a></li> <li class="divider"></li> <li><a href="http://enderbase.com/activate.php">Account Activation</a></li> </ul> </li> <?php } ?> </ul> - W Thanks Yomanny! and JCbones! Quote Link to comment https://forums.phpfreaks.com/topic/275571-how-can-i-hide-a-menu-item-from-a-registered-user/#findComment-1418400 Share on other sites More sharing options...
MrSamCraft Posted March 13, 2013 Author Share Posted March 13, 2013 When you're printing out the menu, you could throw in an if, just like jcbones suggested: <ul class="nav"> <li class="active"><a>Home</a></li> <li><a href="http://enderbase.com/about.php">About</a></li> <li><a href="http://enderbase.com/contact.php">Contact</a></li> <?php if(!logged_in()) { ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Register/Login <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="http://enderbase.com/register.php">Register</a></li> <li><a href="http://enderbase.com/login.php">Login</a></li> <li class="divider"></li> <li><a href="http://enderbase.com/activate.php">Account Activation</a></li> </ul> </li> <?php } ?> </ul> - W Could I do this for non registered users? to hide stuff if they are not logged in? if(!user_registerd) { ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">My Account<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="http://enderbase.com/account.php">Manage Account</a></li> <li><a href="http://enderbase.com/register.php">My Submissions</a></li> <li><a href="http://enderbase.com/logout.php">Logout</a></li> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/275571-how-can-i-hide-a-menu-item-from-a-registered-user/#findComment-1418418 Share on other sites More sharing options...
MrSamCraft Posted March 13, 2013 Author Share Posted March 13, 2013 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/275571-how-can-i-hide-a-menu-item-from-a-registered-user/#findComment-1418461 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.