vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Modify Post as Displayed (https://vborg.vbsupport.ru/showthread.php?t=200910)

weinstoc 01-06-2009 11:12 PM

Modify Post as Displayed
 
We'd like to create a plugin(?) that modifies a post before it is displayed to remove URL links for a specific set of URL's as the post is being displayed:

For instance we'd like to modify http://unpaid_advertisement_site.com so that the link is removed (i.e., "http://unpaid_advertisement_site.com" instead).

I'm not sure how to accomplish this cleanly. Any advice would be appreciated.

Chuck

Lynne 01-06-2009 11:40 PM

Have you tried the Replacement Manager? I'm not sure if it would work, but it may. Find what the link looks like in the page source - <a href="xxxx">xxxx</a> maybe? And put the full thing in to be replaced and the single non-parse link as the replacement. Again, I'm not sure if that will work.

weinstoc 01-06-2009 11:57 PM

Quote:

Originally Posted by Lynne (Post 1703732)
Have you tried the Replacement Manager? I'm not sure if it would work, but it may. Find what the link looks like in the page source - <a href="xxxx">xxxx</a> maybe? And put the full thing in to be replaced and the single non-parse link as the replacement. Again, I'm not sure if that will work.

The problem is that the replacement manager doesn't allow for enough characters. I know we can modify it but then we have to keep modifying everytime there is a new release.

Chuck

Lynne 01-07-2009 02:32 AM

Are you talking about the size of the input box on the screen? It will just scroll with the contents of what you put in there.

Bellardia 01-07-2009 03:55 AM

If you want to rewrite links, you'll want to use two plugins.

This one will take the text to be posted, and submit it to a function so can it can be run through a preg_replace or similar function.
Code:

<plugin active="1" executionorder="5">

                        <title>Title Of Mod</title>

                        <hookname>postbit_display_complete</hookname>

                        <phpcode><![CDATA[global $vbulletin;

                        $this->post['message'] = Function_Name($this->post['message']);

                        ]]></phpcode>

</plugin>

Another code in the global_start hook can be used to hold the source of the link replacement, modify the post and return it however you want.
Code:

<title>Plugin Title</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[
            function Function_Name($post) {
                                global $vbulletin;
                //Preg_replace + other Functions
                return $post;
            }
]]></phpcode>


goetz 01-07-2009 06:45 PM

Is it possible to do a search and replace on the bb instead? Different hook location?

--------------- Added [DATE]1231361257[/DATE] at [TIME]1231361257[/TIME] ---------------

Quote:

Originally Posted by Lynne (Post 1703818)
Are you talking about the size of the input box on the screen? It will just scroll with the contents of what you put in there.

After saving, it appears that the content is truncated to 100 characters.

Bellardia 01-07-2009 07:20 PM

Quote:

Originally Posted by goetz (Post 1704410)
Is it possible to do a search and replace on the bb instead? Different hook location?

--------------- Added [DATE]1231361257[/DATE] at [TIME]1231361257[/TIME] ---------------



After saving, it appears that the content is truncated to 100 characters.

Although you can do the replace on the bb code, I believe you will have to hardcode it into the php files themselves, as standard bb codes aren't editable.

Dismounted 01-08-2009 02:14 AM

You can modify the function of the BB code, by adding a plugin. Look at the end of class_bbcode.php.


All times are GMT. The time now is 03:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01557 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete