Page 1 of 1

Variable

Posted: Fri May 17, 2019 4:24 am
by William959
Hello.

I would like to create a room called {USERNAME}, but I do not even know where to start.
I want to create a BBCODE, but I do not want my BBCode to follow a pattern that is: [user]{TEXT}[/user], I would like my BBCode to be only {USERNAME}. I want when someone types the {USERNAME} variable in the topic, it appears and shows the name of who is reading that topic.
Exemple:

Code: Select all

Hi {USERNAME}!

This is an explanatory topic, etc, etc, etc...
And it will look like this to anyone who reads, suppose you are the Master User.

Code: Select all

Hi Master User!

This is an explanatory topic, etc, etc, etc...

How can I do this? My version of phpBB is the latest one.

Re: Variable

Posted: Fri May 17, 2019 5:15 am
by nou nou

Re: Variable

Posted: Fri May 17, 2019 5:46 am
by William959
nou nou wrote:
Fri May 17, 2019 5:15 am
Ta-daa!

viewtopic.php?f=456&t=2511516

:)
Okay, that's what I was looking for, thank you very much.
But I have some doubts, from this post, a discussion about overloads begins when using JavaScript. Would there be a way to not overload the forum with this extension? Instead of using JavaScript to use PHP itself, or make the changes that it suggested? I do not understand much, could you explain and give me a solution to such doubts?
Another thing, I would like to hide the button that was generated as BBCode and wanted to exchange [username] for {USERNAME} is it possible?

Re: Variable

Posted: Fri May 17, 2019 5:50 am
by nou nou
Best to post these questions in the actual extension topic so the author can answer.

As for overload, I have not seen an issue with that during testing. That said, the extension is still in development so always tread with care... ;)

Re: Variable

Posted: Fri May 17, 2019 5:51 am
by 3Di
Using tokens {USERNAME} in the posting area instead of bbcodes [username] can be done via an extension, yes.
Which I think it is the best solution, so to avoid such JS at all.. just a thought though.

Re: Variable

Posted: Fri May 17, 2019 10:28 am
by EA117
William959 wrote:
Fri May 17, 2019 5:46 am
But I have some doubts, from this post, a discussion about overloads begins when using JavaScript.
That question was not intended to give you any doubts about whether it would be appropriate or safe to use this extension. It was just "a programmer's question" about whether an optimization to the code would be appropriate or beneficial. Meaning the extension worked great for me exactly as it was, and my question was about whether the described code change might make it work even better.

For easily including the username as quickly and easily as you refer to any other BBCode, I think it's a really useful solution. The only reason I'm not running it is because I needed a different piece of information, not "username".

Re: Variable

Posted: Fri May 17, 2019 1:05 pm
by William959
Oh yes, thank you for clarifying me.

What part of the code do I edit to switch [username] to {USERNAME}? Thank you!

Re: Variable

Posted: Fri May 17, 2019 1:27 pm
by EA117
William959 wrote:
Fri May 17, 2019 1:05 pm
What part of the code do I edit to switch [username] to {USERNAME}? Thank you!
I believe that 3Di was describing the creation of a different kind of extension that would handle insertion of the username using a non-BBCode-dependent mechanism.

For the current BBCode Username extension, you would have to use [username], same as the syntax of any BBCode. There is not an option or a simple change you could make in the current extension to "use {username} instead", because it's actually phpBB's own BBCode system that imposes this syntax.