Jump to content

Hide Menu Items before user login


snofire

Recommended Posts

Hello everyone. I'm very new to WHCMS so trying to do as much research as I can but need some assistance on this.

On the main page before a user logs in at the homepage there are menu options up top that I want to Hide. Everything I'm finding as a hook pertains to being in the client area. 

 

Also side question on where do we find the main page php to modify any words or anything (ie. What would you like to do today?)

Capture.JPG

Link to comment
Share on other sites

Go to "header.tpl" in your template folder.

Put

 {if $loggedin}

tag before <nav> (check here) and close the tag properly (line 134)

This will hide all the nav bar.

If you want to hide only the line, but keep the blue nav bar as it is, put the tag in line 120 (before the include file)

Edited by pRieStaKos
Link to comment
Share on other sites

17 hours ago, snofire said:

On the main page before a user logs in at the homepage there are menu options up top that I want to Hide. Everything I'm finding as a hook pertains to being in the client area. 

the "client area" is basically everything that a user can see from their front-end... they may be a client, or just a new visitor to your site and it includes the opening pages, the cart and all the client-only pages that can be seen when a user logs in.

the action hook equivalent of what @pRieStaKos suggests with his template edit, would be to hide by navbar using css if the user is not logged in...

<?php

# Hide Navbar If User Not Logged In Hook
# Written by brian!

function hide_navbar_hook($vars) {

	$client = Menu::context('client');
	if (!$client) {
		$csscode = "<style>#main-menu { display: none; }</style>";
	    return $csscode;
	}
}
add_hook("ClientAreaFooterOutput", 1, "hide_navbar_hook");

or using JavaScript...

<?php

# Hide Navbar If User Not Logged In Hook
# Written by brian!

function hide_navbar_hook($vars) {

	$client = Menu::context('client');
	if (!$client) {
		$csscode = "<script> $(function() {
	        $('#main-menu').remove();
        });
        </script>";
	    return $csscode;
	}
}
add_hook("ClientAreaFooterOutput", 1, "hide_navbar_hook");

TsgvUuf.png

IGEqTR6.png

17 hours ago, snofire said:

Also side question on where do we find the main page php to modify any words or anything (ie. What would you like to do today?)

if you just want to change the text, then you can use the Language Overrides feature and modify the strings for each language that you wish to change.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated