Announcement

Collapse
No announcement yet.

BB Code Filter Function?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • BB Code Filter Function?

    Not getting much luck over at vbulletin.org, so posting this here and crossing fingers Maybe the vB developers know of such a function nestling in the depths of the vB code...

    Before I start to write my own, does anybody know of the existence of a function to strip out all the text between BB code tags?

    This is for a "latest posts" display, that prints the first dozen or so words of a post. For example running this through it:

    [QQUOTE=miner2049er] Actually, Saturday night I was with friends at the El Compadre restaurant in Hollywood, on Sunset. I just had drinks, but they had the best salsa I have tasted for years - a good level of spiciness! Very nice place also.[/QQUOTE]Oh yea...El Compadre...chips and salsa....it's about the best thing

    would return:

    Oh yea...El Compadre...chips and salsa....it's about the best thing

    In other words, I want to grab the first dozen or so words from a post that a person typed in, and nothing inside quote or image tags etc.

    Thanks in advance for any replies,

    Miner2049er.

  • #2
    I know of no such default function, but I'm not sure what you want a bbcode to do, sounds like you almost want to grab data from another post/point and insert it into the current post? That would be alot of overhead depending on how it was done.

    Since it sounds like it will require modifiying the code, you should seek help at vBulletin.org. If no one is helping you at all, either no one understands or no one has an intrest in what you want, sometimes this is unavoidable. Would you write, develop, support, something you had no intrest or need for?

    Comment


    • #3
      You could try to have a look into the code that is used to generate the Thread Previews (the text that popup if you hoover over a thread on forumdisplay).
      Want to take your board beyond the standard vBulletin features?
      Visit the official Member to Member support site for vBulletin Modifications: www.vbulletin.org

      Comment


      • #4
        Originally posted by MarcoH64
        You could try to have a look into the code that is used to generate the Thread Previews (the text that popup if you hoover over a thread on forumdisplay).
        That is almost exactly what I'm looking for - thanks.

        After some testing, the code doesn't seem to filter out IMG or URL tags (and maybe others) but it does ignore QUOTEd text.

        I shall be looking for that code now.

        Cheers, Miner2049er.
        Last edited by miner2049er; Mon 20 Feb '06, 8:24am.

        Comment


        • #5
          For those interested, here's the code - it's in functions_forumdisplay.php:

          $thread['preview'] = strip_quotes($thread['preview']);
          $thread['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(
          strip_bbcode($thread['preview'], false, true),
          $vbulletin->options['threadpreview']
          )));

          and the called functions are in functions.php and class_core.php

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X