Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-06-2009, 11:12 PM
weinstoc weinstoc is offline
 
Join Date: Apr 2007
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 01-06-2009, 11:40 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 01-06-2009, 11:57 PM
weinstoc weinstoc is offline
 
Join Date: Apr 2007
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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
Reply With Quote
  #4  
Old 01-07-2009, 02:32 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 01-07-2009, 03:55 AM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #6  
Old 01-07-2009, 06:45 PM
goetz goetz is offline
 
Join Date: Nov 2007
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 View Post
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.
Reply With Quote
  #7  
Old 01-07-2009, 07:20 PM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by goetz View Post
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.
Reply With Quote
  #8  
Old 01-08-2009, 02:14 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:39 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03995 seconds
  • Memory Usage 2,231KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete