ElkArte Community

Title: Auto Hyperlink
Post by: anagnam on October 19, 2015, 04:28:01 am
Hello Devs,

Is it possible that all posts created whether its new or old can have automatic hyperlink on it when the user post it?
Example. if create a new topic or reply to the topic and I type in "elkarte" somwhere in the editor, that word will get hyperlinked to a pre-defined URL that is set in the admin area once I post it.

thanks in advance once again.
Title: Re: Auto Hyperlink
Post by: TE on October 19, 2015, 04:33:12 am
yep, should be possible with the "censored words" feature..

Admin - Forum - Posts and Topics - censored words.
Title: Re: Auto Hyperlink
Post by: Jorin on October 19, 2015, 05:06:47 am
I don't think so, @TE - Therefor ElkArte must use a prefix and suffix with the censor function.

ElkArte has to make an URL BBC out of a single word. From:

Code: [Select]
ElkArte

to:

Code: [Select]
[url=http://elkarte.net]ElkArte[/url]

So [url=http://elkarte.net] must be set before and [/url] has to be set after the word.
Title: Re: Auto Hyperlink
Post by: anagnam on October 19, 2015, 07:08:20 am
@TE @Jorin it works! thanks very much!
Title: Re: Auto Hyperlink
Post by: Jorin on October 19, 2015, 07:16:24 am
Really? What exactly did you use?
Title: Re: Auto Hyperlink
Post by: anagnam on October 19, 2015, 07:50:35 am
@Jorin  I used your same example above. I tested it and it worked! ;-)
Title: Re: Auto Hyperlink
Post by: Jorin on October 19, 2015, 07:56:28 am
Oh. Ehm. Oh. Gotta go!  :-[
Title: Re: Auto Hyperlink
Post by: anagnam on October 20, 2015, 01:43:47 am
@Jorin thought you might be interested to know that your solution above works but I found out later that it also affected the title.
@emanuele I hope you could chime in to advice us if there is a way to limit the sensored word to exclude the title?
currently, when I want to censor the word "elkarte" for example to say
Code: [Select]
[url=http://elkarte.net]ElkArte[/url]
it works on new posts and replies. but it also affected the title and its not properly parsed. So while its ok in the body, the title is showing the code snippet.
Can we put an if statement somewhere to only affect the body and not the title?
Title: Re: Auto Hyperlink
Post by: Jorin on October 20, 2015, 01:56:31 am
I didn't remember you could insert text before and after. Great it works!
Title: Re: Auto Hyperlink
Post by: emanuele on October 20, 2015, 01:59:33 am
http://www.elkarte.net/community/index.php?topic=1392.0
Title: Re: Auto Hyperlink
Post by: anagnam on October 20, 2015, 02:21:34 am
thanks @emanuele  this is exactly what I need!