• Hello,

    I have just updated a theme on the website I was using and one of the features was to change the HTML of the navigation based on the user’s current logged in/out state. We use a custom membership site as we have 20K members and did not want to use WordPress for that. The site passes us a “yes/no” if the user is valid, and then we check if they are logged in via a cookie – uber simple set up 😀

    But the following code seems to have killed the site:

    <?php
            try
            {
              $userId = '';
              if(isset($_COOKIE['member']))
                 $userId = $_COOKIE['member'];
    
              if(empty($userId) == 1)
                            {
                                echo '<li><a href="/login/">Login</a></li>';
                            }
                            else
                            {
                                echo '<li class="logged-in">Logged in</li>';
                            }
                        }
                        catch(Exception $e)
                        {
                            /// removed for privacy
                        }
    
                    ?>

    and when I removed it the site started moving smoothly again. So could I ask how would I go about this properly using w3 total cache (and we are on windows so using wincache.dll) so that each user get’s their logged in status confirmed.

    Or should I just use javascript?

  • The topic ‘W3 Total Cache – Custom per user HTML’ is closed to new replies.