Welcome Guest, Not a member yet? Register   Sign In
having a chat widget appear (or not!)
#2

(This post was last modified: 07-20-2021, 05:51 PM by richb201.)

I managed to get the regular old chat widget working. Now I just need to be able to have that appear only for paying users. I created a flag in the session vars for it.  I then tried adding this code. Can I not wrap javascript within a php section? I need to use php to check if the user gets premium support or not. 

<?php
        if ($_SESSION['premium_support']==1)
          {
          <script type="text/javascript">
              var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
              (function(){
                  var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
                  s1.async=true;
                  s1.src='https://embed.tawk.to/5fc604b2a1d54c18d8ef211d/default';
                  s1.charset='UTF-8';
                  s1.setAttribute('crossorigin','*');
                  s0.parentNode.insertBefore(s1,s0);
              })();
          </script>
          }

?>         

How can I accomplish this? 
<?
?>         
proof that an old dog can learn new tricks
Reply


Messages In This Thread
RE: having a chat widget appear (or not!) - by richb201 - 07-20-2021, 05:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB