• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Link in CODE tags

#1
Hi, how to allow linking in CODE tags, what xenforo file to change to allow this ...

I think it is necessary to change her files, because I have done this one time before but I am unable to find now how and what was necessary to change.
library/XenForo/BbCode/Formatter/BbCode

If you somebody can point me what file is striping all tags from CODE tag.
 
#5
Tnx for this, but problem is also that I have meany posts with old
Code:
tags, and wish to allow links in them also.

Can you tell me what file control tags premissions
 

Jeremy

Well-known member
#6
There are no tag permissions in XenForo. You'll need to edit them if you wish to render links in old posts.
 
#7
There are no tag permissions in XenForo. You'll need to edit them if you wish to render links in old posts.
I know that there is in xenForo but I have asked in core files. I do know that this is not recommended method but for now it will do. I just can not find in what files are related to code tags permissions and showing.
 

cclaerhout

Well-known member
#10
Tnx for this, but problem is that I have over 1 000 000+ posts and I think at least 500 000+ have this CODE tags and most likely it would cause server problems.
Then modify the function "parseValidateTagCode" of this class "XenForo_BbCode_Formatter_Base". Test if returning true in any case fixes your problem.
 
#11
Then modify the function "parseValidateTagCode" of this class "XenForo_BbCode_Formatter_Base". Test if returning true in any case fixes your problem.
I managed to allow links in new posts but for old post it still not parse links, this is what I have done;

In file: library/XenForo/BbCode/Formatter/BbCode/AutoLink.php I removed "code" from

PHP:
 protected $_disableAutoLink = array('url', 'email', 'img', 'php', 'html', 'plain', 'media');
and in /home/serbi826/public_html/library/XenForo/BbCode/Formatter/Base.php I removed:

PHP:
'parseCallback' => array($this, 'parseValidateTagCode'),
and this allowed posting links, and it show them OK, but for old links in CODE they are still not linked, I did try diffrent combination but it look like I am missing some function
 

cclaerhout

Well-known member
#12
The autolinking might be done when the post is saved or edited. So it's not done during the parsing, which explains why any methods might not work for what you attend to do.
 

cclaerhout

Well-known member
#13
@Neso
May be not the best way, but you can try to add this code:
PHP:
 $content = XenForo_Helper_String::autoLinkPlainText($content);
After:
PHP:
$content = $this->renderSubTree($tag['children'], $rendererStates);
In the renderTagCode function.
 
#14
@Neso
May be not the best way, but you can try to add this code:
PHP:
 $content = XenForo_Helper_String::autoLinkPlainText($content);
After:
PHP:
$content = $this->renderSubTree($tag['children'], $rendererStates);
In the renderTagCode function.
This cause some problems with link parsing, but for now I have postponed this, it is important to me to work with new links ...

There is one more problem with this, if you add some text (link title) inside CODE and use URL tag to link it it will just show link title in CODE but link will be lost ... can you maybe point me what function is related to this,