asigno Posted March 5, 2019 Posted March 5, 2019 Hi, I'm using an expression to put the members group Id into a JS variable, which is causing an issue with emoticons from loading. I've tried pushing the value to the console rather than as a variable and I've also tried renaming the variable as well and the issue still exists, so I feel that it's the actual PHP expression which is causing the issue. <script> var groupId = {expression="\IPS\Member::loggedIn()->member_group_id"}; </script> This is the error in the console: Uncaught TypeError: Cannot read property 'length' of undefined at baseController._buildEmoji (root_framework.js.1b5af06ae17ee2cabc48118aba3e1865.js.gz:951) at baseController.<anonymous> (root_framework.js.1b5af06ae17ee2cabc48118aba3e1865.js.gz:947) The site is : https://yamahaclub.com/forums/ Any ideas would be most helpful. Cheers
bfarber Posted March 6, 2019 Posted March 6, 2019 I'm not convinced the error is related to your javascript variable. If you remove your variable does the error actually go away?
asigno Posted March 12, 2019 Author Posted March 12, 2019 Hi @bfarber sorry for late repsonse I forgot to tick notifiy me of replies. Yes if I remove that line code the smilies work fine and I don't get any console errors. I've even created a new default theme and still get the same issue.
bfarber Posted March 12, 2019 Posted March 12, 2019 If you view the page source for the variable, is it creating a valid value? I'm having a hard time seeing on the surface why that code would cause the error you've supplied.
asigno Posted March 12, 2019 Author Posted March 12, 2019 @bfarber Yeah the code is working fine, this is what is rendered <script> var groupId = 4; </script> I thought at first it was just a conflict with the variable name, but on renaming it's the same issue.
asigno Posted March 13, 2019 Author Posted March 13, 2019 Hmm. If I switch to the default theme and then switch back to my custom theme the emoji load ok.
bfarber Posted March 13, 2019 Posted March 13, 2019 Yeah I can't see any way whatsoever your javascript code would be the problem, particularly if you've tried renaming the variable.
asigno Posted March 17, 2019 Author Posted March 17, 2019 Finally found the issue, it was something in tag manager which was only happening when that variable was created. Thanks for your help.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.