Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 04-18-2010, 01:24 AM
Breakpoint Breakpoint is offline
 
Join Date: Dec 2005
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Trying to convert a plugin

I need to convert a plugin so the code works in VB4

Here is the code, can anyone please help me convert it. I am having some difficulties on how to change this to be biable in VB$

Code:
if ($_REQUEST['do'] == 'editthread' AND $threadinfo['open'] != 10) {
$vbulletin->templatecache['threadadmin_editthread'] = str_replace('$posticons','		<fieldset class=\"fieldset\">
			<legend>$vbphrase[redirect_threads_to_url]</legend>
			<div style=\"padding:$stylevar[formspacer]px\">
				<div class=\"fieldset\">
					$vbphrase[redirect_threads_to_url_link]<br />
					<input type=\"text\" class=\"bginput\" name=\"isurlredirect\" value=\"$threadinfo[isurlredirect]\" size=\"50\" maxlength=\"250\" title=\"$vbphrase[optional]\" />
				</div>

			</div>
		</fieldset>
		
		$posticons',$vbulletin->templatecache['threadadmin_editthread']);
}
The main reason it is not working in VB4 is because it is trying to replace the $posticon which no longer exists in the template
Reply With Quote
  #2  
Old 04-18-2010, 06:43 AM
Dylanblitz Dylanblitz is offline
 
Join Date: Oct 2005
Location: OC, California
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Give this a try, not 100% sure but it should work

Code:
if ($_REQUEST['do'] == 'editthread' AND $threadinfo['open'] != 10)
{
$vbulletin->templatecache['threadadmin_editthread'] = str_replace('{vb:raw posticons}','		<fieldset class=\"fieldset\">
	<legend>{vb:rawphrase redirect_threads_to_url}</legend>
	<div style=\"padding:{vb:stylevar formspacer}px\">
		<div class=\"fieldset\">
		{vb:rawphrase redirect_threads_to_url_link}<br />
		<input type=\"text\" class=\"bginput\" name=\"isurlredirect\" value=\"{vb:raw threadinfo.isurlredirect}\" size=\"50\" maxlength=\"250\" title=\"{vb:rawphrase optional}\" />
		</div>

	</div>
</fieldset>
		
{vb:raw posticons}',$vbulletin->templatecache['threadadmin_editthread']);
}
Reply With Quote
  #3  
Old 04-18-2010, 02:43 PM
Breakpoint Breakpoint is offline
 
Join Date: Dec 2005
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That didn't work, I am cuirous if its due to the string {vb:raw posticons} needing to be escaped due to maybe some conflicts with PHP or not
Reply With Quote
  #4  
Old 04-18-2010, 02:49 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In plugins, you don't use the new template syntax. You need to use, for instance, '.$vbphrase[redirect_threads_to_url].'
Reply With Quote
  #5  
Old 04-18-2010, 03:18 PM
Breakpoint Breakpoint is offline
 
Join Date: Dec 2005
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I got that part, but how would I be able to refer to the {vb:raw posticons} portion in the code and also outbut something like {vb:raw posticons} since $posticons doesn't work

thanks
Reply With Quote
  #6  
Old 04-18-2010, 07:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I really don't understand what you mean. You want to modify the variable $posticons? On what page? When I do a search for $posticons in the files, I get several hits. So, which one of those pages are you looking to do something to? And did you pick an appropriate hook location?
Reply With Quote
  #7  
Old 04-18-2010, 10:42 PM
Breakpoint Breakpoint is offline
 
Join Date: Dec 2005
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hook: threadmanage_start
Template: threadadmin_editthread

What the code did was look for the instance of $posticon in that template an replace it with code which added an input field for added text.

Now I need to update his code to work in VB4 which seems to have {vb:raw posticons} in the template instead of $posticons

----

On a side note, lets say I wanted to make a plugin display Pst Icons, how would i make it since saying echo {vb:raw posticons}; or echo '{vb:raw posticons}'; doesn't work.
Reply With Quote
  #8  
Old 04-19-2010, 03:51 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In php, it is still called $posticons. {vb:raw posticons} is just template syntax.
Reply With Quote
  #9  
Old 04-20-2010, 01:24 AM
Breakpoint Breakpoint is offline
 
Join Date: Dec 2005
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that doesnt work in the old code though when you run string replace function. Did switching to this "easy" template syntax ruin that? I bet so, not easy for programmers... who decided this should revert it back. Having two sepearate syntax's versus one is the opposite direction they were trying to go for...
Reply With Quote
Reply

Thread Tools
Display Modes

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 04:40 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.08667 seconds
  • Memory Usage 2,235KB
  • Queries Executed 13 (?)
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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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