The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
BBCodes get converted except for QUOTE and CODE - Why? Please help!
I'm trying to use a plugin which allows (amongst other things) to treat a forum as a "new forum". The plugin then simply allows the posts to be listed as "news".
HOWEVER, if the posts use any QUOTE or CODE tags, the text within these tags is completely lost and does not get returned from the code. IMG tags etc are processed fine for example, just not QUOTE or CODE ones. So I'm a little baffled as to why no text is returned at all for these tags (even if wasn't correctly formatted). Is anyone able to shed any light on the reason why the text (on these tags) might being going AWOL? Not being able to use QUOTE is a big loss! The thread about the plugin is [url]https://vborg.vbsupport.ru/showthread.php?t=83005[url] - I posted this very question there (along with others) but no reply/help has been forthcoming |
#2
|
||||
|
||||
look in yourforum/includes/class_bbcode.php around line 126 and around line 141 for information on how those two bbcode tags work.
|
#3
|
|||
|
|||
Quote:
A call to that function (vB_BBCodeParser) already exists.... Is it maybe simply not calling it correctly for the post's text to deal with QUOTE and CODE tags? Can you see it being used to process the text into "post"? Code:
function output_News($a = 5,$f = ""){ global $db, $Data, $vbulletin; // Define amount to show $Amount = ($a)? intval($a) : 5; // Define Forum To Pull From $Forum = ($f)? intval($f): ''; if(!$Forum){ RunError("No specified forum to pull news from."); } // Load Template $Template = LoadTemplate("news.html"); // Collect Data $NewestNews = $db->query(" select t.*,p.pagetext from ".TABLE_PREFIX."thread t left join ".TABLE_PREFIX."post p on(p.postid=t.firstpostid) where t.forumid = $Forum order by dateline desc limit 0,$Amount"); $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); while($News = $db->fetch_array($NewestNews)){ $neils_date = date( "l j", $News['dateline']) . "-" . substr(date( "F", $News['dateline']),0,3) . "-" . date( "Y", $News['dateline']); $Data .= ParseTemplate($Template, array( 'threadid' => $News['threadid'], 'threadname' => $News['title'], 'postuserid' => $News['postuserid'], 'postusername' => $News['postusername'], 'post' => $bbcode_parser->parse(unhtmlspecialchars($News['pagetext']), $f), 'comments' => vb_number_format($News['replycount']), 'postdate' => $neils_date, ) ); } Also in other examples I've seen do_parse is referenced, not "parse"? Note: Other tags are being converted (eg: IMG and URL) |
#4
|
|||
|
|||
If I do:-
$neils_text = $bbcode_parser->do_parse($News['pagetext'], 0, true, false, true, true, 0); No BBCode is transformed! And if I do:- $neils_text = $bbcode_parser->do_parse($News['pagetext'], 0, true, true, true, true, 0); All BBCode is transformed except for QUOTE and CODE... What is so special about QUOTE and CODE? HELP!!!! |
#5
|
|||
|
|||
Years later, I am having the same problem, exactly! I'm working on Cyrcix's Email Integration.
$html = $parser->do_parse($bbcode, true, true, true, true, true, 0); Both [code] and [quote] blocks result in nothing in the HTML output. I have traced it through class_bbcode.php to the point where it fetches the conversion templates for bbCodes. Using a tracing file and fwrite() statements, I have determined that in the function handle_bbcode_code(), the call to fetch_template('bbcode_code') is returning nothing! Here's the corker: Out of the 20+ tests I did, one time it worked! I then ran the test again without changing anything at all and it failed as before. Throughout, I didn't change anything in the code except to add fopen(), fwrite(), and fclose() to do the tracing (I'm working on a remotely hosted system, ugh). The difference is that this code is running as a vBulletin Scheduled Task (cron). The same code in another area of the plugin that runs in the normal VB posting context works reliably. Can anyone give me a hint? The fact that it works once in a blue moon and fails otherwise, with no code changes, has me baffled. |
#6
|
|||
|
|||
This is a crazy problem. I "solved" it by hand-converting the quote and code blocks with preg_replace(). I believe the template cache needs to be loaded in the cron task explicitly. The reason it worked once in a blue moon is that it just happened to run while a forum page was being rendered for some user and the template cache happened to have stuff in it. That's just a theory though!
|
#7
|
|||
|
|||
When ran from the Scheduled Task, you must ensure that al needed template groups have been loaded.
That it might work once and not again might be caused by the cache. Either (temporary) disable the post cache or clear the cache table. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|