Can';t让变量在Wordpress for Intercom Javascript中工作

Can';t让变量在Wordpress for Intercom Javascript中工作,javascript,php,wordpress,intercom,Javascript,Php,Wordpress,Intercom,对讲机在body标记之前提供以下要插入的代码段: <script> window.intercomSettings = { app_id: "", name: "<?php echo json_encode($current_user->name) ?>", // Full name email: "<?php echo json_encode($current_user->email) ?>", // Email ad

对讲机在body标记之前提供以下要插入的代码段:

<script>
  window.intercomSettings = {
    app_id: "",
    name: "<?php echo json_encode($current_user->name) ?>", // Full name
    email: "<?php echo json_encode($current_user->email) ?>", // Email address
    created_at: "<?php echo strtotime($current_user->created_at) ?>" // Signup date as a Unix timestamp
  };
</script>

window.com设置={
应用程序id:“”,
名称:,//全名
电子邮件:,//电子邮件地址
在以下位置创建了\//注册日期作为Unix时间戳
};

但是,它创建的启动器有一个错误;声明检查电子邮件变量。Wordpress的变量应该是什么?

它不应该在body之前注入,它必须在body close标记之前

<script>
  window.intercomSettings = {
    app_id: "",
    name: "<?=wp_get_current_user()->user_login?>", // Full name
    email: "<?=wp_get_current_user()->user_email?>", // Email address
    created_at: "<?=strtotime(wp_get_current_user()->created_at)?>" // Signup date as a Unix timestamp
  };
</script>
</body>

window.com设置={
应用程序id:“”,
名称:,//全名
电子邮件:,//电子邮件地址
在以下位置创建了\//注册日期作为Unix时间戳
};

对不起,我就是这个意思。我将代码片段放在body close标记之前,发现了错误。我已修改了答案,请尝试一下。不确定您对对讲机的熟悉程度,它们为登录用户提供了一个代码片段,为访客提供了一个代码片段。您知道是否可以将两个代码片段放在同一页上吗?ie当用户注销时,是否使用访问者脚本?