Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Set Name/Email Automatically

$
0
0

Replies: 0

Using the JS Api, it’s possible to get the job done.
But, how do we append the username and email inside the Javascript for a default WordPress installation?

<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/*/default';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();

window.Tawk_API.onLoad = function(){
    window.Tawk_API.setAttributes({
        'name'  : '<?php echo get_current_user_id(); ?>'
        'email' : '<?php echo get_current_user_email(); ?>'
    }, function(error){});
}
</script>

Viewing all articles
Browse latest Browse all 59525

Trending Articles