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

You can accomplish this, but you can't just embed Javascript code directly in your PHP code.

Code:
<?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>
<?php endif; ?>

The only thing to make sure of is that the session variable 'premium_support' has a value.
Reply


Messages In This Thread
RE: having a chat widget appear (or not!) - by craig - 07-21-2021, 01:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB