PDA

View Full Version : passing a vbulletin variable to javascript


m0nde
09-15-2016, 06:37 AM
I'm trying to pass a person's userid to javascript. I've set up the following test in my footer.

<script type="text/javascript">
<!--
var userid = parseInt("$bbuserinfo['userid']", 10);
// -->
document.write("<strong>test " + userid + "</strong>");
</script>

I get the following.

https://vborg.vbsupport.ru/external/2016/09/8.png

What am I doing wrong?

Dave
09-15-2016, 12:29 PM
If this is in a template, then you have to use vBulletin 4 template syntax.
It would be something like {vb:raw bbuserinfo.userid} instead of $bbuserinfo['userid'].