Announcement

Collapse
No announcement yet.

​Find and replace text in all posts in Vb5х

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

  • ​Find and replace text in all posts in Vb5х

    Hello! Need help!
    For finding and replacing text in Vbulletin 4 i used this Hook:

    Product : vBulletin
    Hook Location: postbit_display_complete
    Execution Order: 5
    Plugin PHP Code:
    $search = 'xxx;
    $replace = 'zzz;
    $this->post['message'] = str_replace($search, $replace, $this->post['message']);

    And it works!
    But i don't know how to do the same in Vbulletin 5

    As i understand i need to go to Admincp > Products & Hooks > Manage Hooks and click the link that says "[Add New Hook]"
    Product : vBulletin
    Hook Location: conversation –reply_threadview_text_1
    Execution Order: 5
    Template Name:

    As i understand i need to create a new template, for example «conversation_replacing»
    But what i should do to make text from the post go to str_replace()?
    What i should mention in "Hook Arguments:" to make the hook work?

    Please if you know how to do it - explain step by step, i 'm very new in this area.

    Thank to all!
    PS Sorry for my bad english!

  • #2
    You would need to write an extension of the parsing classes to do this. You can't do this with a template hook. You should ask about this over at www.vbulletin.org.

    Though have you tried using replacement variables?
    Last edited by Wayne Luke; Tue 7 Jan '14, 9:09am.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API - Full / Mobile
    Vote for your favorite feature requests and the bugs you want to see fixed.

    Comment


    • #3
      Hello Wayne Luke!

      You see I use Regular Expression and preg_replace($search, $replace, $text) in order to add the text I need to the different URLs.
      For example I replace http://abc.com/abc and http://abc.com/def by http://abc.com/abc/text or http://abc.com/def/text

      So I think that “replacement variables” is not what I need.

      Any other ideas?

      Comment


      • #4
        You would need to write a PHP class extension.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API - Full / Mobile
        Vote for your favorite feature requests and the bugs you want to see fixed.

        Comment


        • #5
          O'k, i think so too. It is already 4 days since i started to learn php so i am on the right way
          Thank you for help!

          Comment


          • #6
            There is no real equivalent to postbit_display_complete in VB5. You can edit the HTML code before it gets cached but not the raw BBCocde source.

            Take a look at this modification I made- http://www.vbulletin.org/forum/showthread.php?t=288954 - it scans the text for links and tries to find the title tag- it can be adapted to so whatever you want with the post text though.

            Comment


            • #7
              Joe D., thank you very much! It looks like i can use your experience somehow. At least i will try

              Comment

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