natashome Posted December 6, 2009 Posted December 6, 2009 hi i am trying to display some links on the header only for logged in users. can someone help me out with the <?php if (tep_session_is_registered('customer_id')) function? so if the user is not registered other links should be displayed and once he logins others. thank you
♥FWR Media Posted December 6, 2009 Posted December 6, 2009 hi i am trying to display some links on the header only for logged in users. can someone help me out with the <?php if (tep_session_is_registered('customer_id')) function? so if the user is not registered other links should be displayed and once he logins others. thank you <?php if( tep_session_is_registered( 'customer_id' ) && is_numeric( $_SESSION['customer_id'] ) ) { // Show only logged in menu } else { // Show menu for customers who are not logged in } ?> Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
natashome Posted December 6, 2009 Author Posted December 6, 2009 <?php if( tep_session_is_registered( 'customer_id' ) && is_numeric( $_SESSION['customer_id'] ) ) { // Show only logged in menu } else { // Show menu for customers who are not logged in } ?> hy thank you for you reply...i am getting this error: Parse error: syntax error, unexpected '<' in /home/content/includes/header.php on line 83 this is my menus and code in header.php: <?php if( tep_session_is_registered( 'customer_id' ) && is_numeric( $_SESSION['customer_id'] ) ) { <li class="submenu"><span class="submenu">My Account</span> <ul class="level_2"> <li class="first"><a href="account_edit.php" title="Edit Account" class="first" onclick="this.blur();">Edit Account</a></li> <li><a href="account_password.php" title="Change Password" onclick="this.blur();">Change Password</a></li> <li><a href="account_history.php" title="Order History" onclick="this.blur();">Order History</a></li> <li><a href="account_newsletters.php" title="Newsletter" onclick="this.blur();">Newsletter</a></li> <li><a href="wishlist.php" title="Wishlist" onclick="this.blur();">My Wishlist</a></li> <li class="last"><a href="logoff.php" title="logoff" class="last" onclick="this.blur();">LogOff</a></li> </ul> </li> } else { <li class="submenu"><span class="submenu">My Account</span> <ul class="level_2"> <li class="first"><a href="login.php" title="login" class="first" onclick="this.blur();">Login</a></li> <li class="last"><a href="create_account.php" title="create account" class="last" onclick="this.blur();">Create Account</a></li> </ul> </li> } ?> line 83 is: <li class="submenu"><span class="submenu">My Account</span>
germ Posted December 6, 2009 Posted December 6, 2009 <?php if( tep_session_is_registered( 'customer_id' ) && is_numeric( $_SESSION['customer_id'] ) ) { ?> <li class="submenu"><span class="submenu">My Account</span> <ul class="level_2"> <li class="first"><a href="account_edit.php" title="Edit Account" class="first" onclick="this.blur();">Edit Account</a></li> <li><a href="account_password.php" title="Change Password" onclick="this.blur();">Change Password</a></li> <li><a href="account_history.php" title="Order History" onclick="this.blur();">Order History</a></li> <li><a href="account_newsletters.php" title="Newsletter" onclick="this.blur();">Newsletter</a></li> <li><a href="wishlist.php" title="Wishlist" onclick="this.blur();">My Wishlist</a></li> <li class="last"><a href="logoff.php" title="logoff" class="last" onclick="this.blur();">LogOff</a></li> </ul> </li> <?php } else { ?> <li class="submenu"><span class="submenu">My Account</span> <ul class="level_2"> <li class="first"><a href="login.php" title="login" class="first" onclick="this.blur();">Login</a></li> <li class="last"><a href="create_account.php" title="create account" class="last" onclick="this.blur();">Create Account</a></li> </ul> </li> <?php } ?> You can't mix HTML and PHP code like you were trying to do. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
♥FWR Media Posted December 6, 2009 Posted December 6, 2009 Edit .. I was looking at Germs code ;) The code Germ posted is perfect. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
natashome Posted December 6, 2009 Author Posted December 6, 2009 thank you so very much to both of you :rolleyes:
Recommended Posts
Archived
This topic is now archived and is closed to further replies.