Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Black Tiger Posted February 26, 2019 Posted February 26, 2019 Hello. I'm trying to customize some piece of javascript which I would like to put on my forum in a page. Hello {member_name} welcome on our forum Or maybe also the sitename variable. However, if I put this in the wysiwig editor in source code html, it will display exactly this and not the username. I also tried with: Hello {member_name|raw} welcome on our forum which had the same result. Somewhere else on the net I've seen somebody using %member_name% but that was for messages. In the mass email function {member_name} is used. How can I use the variables (and which) in the forum itself in a page or block like described above?
Aiwa Posted February 26, 2019 Posted February 26, 2019 Email templates and theme templates for display are different animals. {member=name} would be what you need for the currently logged in member IF you're working in a theme template. Add raw="true" within the {} if you don't want it html escaped.
Black Tiger Posted February 26, 2019 Author Posted February 26, 2019 I'm not working in a theme, at least... I don't now. I'm not into coding normally. I just created a page with and wanted that this page said "hello" to the user visiting it. So i should do it like this then? Hello {member=name raw="true"}
Nathan Explosion Posted February 26, 2019 Posted February 26, 2019 3 minutes ago, Black Tiger said: I just created a page with How are you creating the page? Is it using Pages.....are you using 'Page Builder' or is it 'Manual HTML'? Give more detail about what you are creating, and it gives an idea of what your options will actually be.
Black Tiger Posted February 26, 2019 Author Posted February 26, 2019 I tried with Pages by choosing Manual HTML and I also tried with the Page Builder and using the Wysiwyg editor using source html code with the source button. I'm trying to put something like this there (it's in dutch): <font color=red>Welkom op Satellite Fun</font> Leuk om je erbij te hebben <b>{member="name" raw="true"}</b><br /> Veel plezier gewenst!<br /> <script language="JavaScript" type="text/javascript"> document.write(' Uw laatste bezoek was op '); document.write(maakDatum(new Date())); document.write('.'); </script> <script LANGUAGE="JavaScript" type="text/javascript">schrijfKlok() </script> It's part of some larger script code I got, and it puts in all the text and the time and date correctly. The only thing not showing is the username.
Nathan Explosion Posted February 26, 2019 Posted February 26, 2019 4 minutes ago, Black Tiger said: choosing Manual HTML <font color=red>Welkom op Satellite Fun</font> Leuk om je erbij te hebben <b>{member="name"}</b><br /> Veel plezier gewenst!<br />
Black Tiger Posted February 26, 2019 Author Posted February 26, 2019 Thank you very much! Got it working on a page now. But isn't it possible to put this in a block so I can put it here, like in the screenshot?
bfarber Posted February 27, 2019 Posted February 27, 2019 Do not use raw="true" for any user-submitted text (which includes the username). You will open yourself up to XSS attacks.
Black Tiger Posted February 27, 2019 Author Posted February 27, 2019 Thank you, I will prevent using raw I didn't know that. But is there a way to put such kind of variable in a block like in the screenshot?
Nathan Explosion Posted February 27, 2019 Posted February 27, 2019 2 hours ago, Black Tiger said: But is there a way to put such kind of variable in a block like in the screenshot? If you create the block as a Manual HTML or Manual PHP, yes. You can't do this via the Editor.
Black Tiger Posted February 27, 2019 Author Posted February 27, 2019 Ehmz... I'm not native English and I'm new to Invision. I presume you mean it can't be done via the Wysiwig editor in page builder? That's a pity. I'll go and search the manual then on how to create custom blocks then. Thank you.
Aiwa Posted February 27, 2019 Posted February 27, 2019 WYSIWYG is exactly what it means. What you see is what you get. There isn't automation built into it because it then wouldn't be WYSIWYG. To build it with any kind of automation, you have to build it as a custom block with manual HTML or PHP.
Black Tiger Posted February 27, 2019 Author Posted February 27, 2019 Yes I know what wysiwyg means. But since you can also put html source code in the wysiwyg editor with html enabled.... html=html. So I don't understand the difference between html source code and html source code in a manual created page. Bug I will figure out how to create a custom block, as soon as Tier II is ready investigating why my database gets cleared out after forum conversion except for uses and forums.
Aiwa Posted February 28, 2019 Posted February 28, 2019 Because {member=name} isn't HTML. It's template logic that IPS parses when displaying. Such parsing isn't done against WYSIWYG data.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.