Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    25
    Plugin Contributions
    0

    Default Dynamic Sidebox Content Based on Login Status

    Hi all,

    I have an image+href sitting in a sidebox. I want the image+href to be set a certain way if the user is currently logged in, and another way if the user is not currently logged in.

    I found some code from other similar forum posts and have adapted my code as below.

    Code:
    if($_GET['id'] == xx and !$_SESSION['customer_id']) {
    $content = "<div style=\"   width:161px; background-color:#FFFFFF; padding:5px; border:2px solid #C7A88B; margin-top:8px;     \"><a href=\"http://mywebsite.com.au/shop/index.php?main_page=login\"><img src=\"images/squirrel02/squirrel-login.jpg\"></a></div>                 ";
    } else {
    $content = "<div style=\"   width:161px; background-color:#FFFFFF; padding:5px; border:2px solid #C7A88B; margin-top:8px;     \"><a href=\"http://mywebsite.com.au/shop/index.php?main_page=logoff\"><img src=\"images/squirrel02/squirrel-logout.jpg\"></a></div>                 ";
    }
    The problem with this method is, it always defaults to the second option. Can somebody show me what I'm doing wrong?

    Many thanks,

    Standbridge

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Dynamic Sidebox Content Based on Login Status

    The if statement might read:

    Code:
    if(isset($_SESSION['customer_id'])){
    //display logged in version
    }else{
    //display not logged in version
    }
    there is something quite different happening with the get parameter.

  3. #3
    Join Date
    Feb 2009
    Posts
    25
    Plugin Contributions
    0

    Default Re: Dynamic Sidebox Content Based on Login Status

    Bloody fantastic Nick!

    Works a treat, many thanks!


    Cheers,

    Chris

 

 

Similar Threads

  1. Attribute Display based on user login / logged out status
    By ailtait in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 19 Jun 2012, 10:43 AM
  2. Replies: 9
    Last Post: 31 Aug 2011, 02:10 AM
  3. Newsletter Sidebox Visible Based on Sub Status
    By ALFO in forum Basic Configuration
    Replies: 2
    Last Post: 18 Feb 2008, 11:44 AM
  4. Dynamic Download Content
    By dmacke in forum General Questions
    Replies: 0
    Last Post: 4 Jan 2008, 03:25 AM
  5. Dynamic main_page content
    By four-point in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 30 Jun 2006, 05:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR