javascript inside php if specific user -


I'm new to PHP, so maybe this is a stupid question. I have some code that show a livechat for all Wordpress users. Should reach, in level 7, and those who do not show anything to any other level.

  // Check if current_user_on_level ($ level_id) returns true or false if (current_user_on_level (7)) {& lt ;! - Start of Zopim Live Chat script - & gt; & Lt; Script type = "text / javascript" & gt; Window. $ Zopim || (Function (d, s) {var z = $ zopim = function (c) {z ._ push (c)}, $ = zs = d.create element (s), e = d. GetElementsByTagName (s) [0] ]; Z.set = function (o) {.z.set _.push (o)} z._ = []; z.set ._ = [];. $ Async =! 0;. $ SetAttribute ( 'Word-phrase', 'utf-8'); $ .src = '// v2.zopim.com/?0xObfhlxyhOFFN07eRruAdGFbEDphAiO';zt=+new date; $ type =' text / javascript '; e.parentNode.insertBefore ( $, E)}) (document, 'script'); & Lt; / Script & gt; & Lt ;! - End of zopime live chat script - & gt; } Other {// nothing}  

I get an error, which says that there is an error in the first line where JS starts.

The code is JS, otherwise you should close the PHP tag and add it as HTML So add a?> And

  (current_user_on_leval (7)) {? & Gt; & Lt ;! - Start of Zopime Live Chat Script - & gt; & Lt; Script type = "text / javascript" & gt; Window. $ Zopim || (Function (d, s) {var z = $ zopim = function (c) {z ._ push (c)}, $ = zs = d.create element (s), e = d. GetElementsByTagName (s) [0] ]; Z.set = function (o) {.z.set _.push (o)} z._ = []; z.set ._ = [];. $ Async =! 0;. $ SetAttribute ( 'Word-phrase', 'utf-8'); $ .src = '// v2.zopim.com/?0xObfhlxyhOFFN07eRruAdGFbEDphAiO';zt=+new date; $ type =' text / javascript '; e.parentNode.insertBefore ( $, E)}) (document, 'script'); & Lt; / Script & gt; & Lt ;! - End of zopime live chat script - & gt; & Lt ;? PHP} and {// nothing}  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -