View Single Post
  #999  
Old 02-05-2009, 04:06 PM
inciarco's Avatar
inciarco inciarco is offline
 
Join Date: Mar 2007
Posts: 758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello vbboarder and J98680B2423E.

I'd like to share with You a Proposed Solution I made to the Conflict with the Mod "Live Topic - AJAX", that is Not Complete (it has its restrictions), to see if you can Help me/us with a Better Solution to be able to Use Both Mods without Conflicts.

I/we Appreciate Your Help in Finding a Better Solution. :up:

(All the Details are on the Following Quoted Post).

My Best Regards.



Quote:
Originally Posted by inciarco View Post
One Possible Solution for Conflict with product "Topic Of The Week_Month Nomination", at least for the Display of Nominated/Winner on the First Post of the Thread, (on all other Posts it won't Display because of the "if" Conditional).

The Conflict with this Product is on the Template "nominate_topic_stamps" that is Triggered by some of the Last Lines of the Plugin "Topic Of The Week_Month Nomination" that uses the Hook "global_setup_complete", lines that will be Commented (to Not be Used) on the Following Solution, and Changed of place to use the Conditional Explained later to Only Use this Template on the First Post of a Thread (whic won't interfere with the Quick Replies).

"Coders Shack" if you can Please Check the mentioned Plugin and the mentioned Template, Analyze the Code, and propose a Better Solution to be able to Not Disable the Code mentioned on the Solution for ALL Posts Except the First One of a Thread, I think many Users will Appreciate that, (I can only offer this Solution with my Limited Knowledge).

Also, if you can Please Confirm me/us if the following Solution Provided won't have any Problems with the Performance of the Display of the Posts, I/we will appreciate it a lot; as you'll see I've changed the Location of that specific Code that causes the Problem to another Plugin where I can use the Conditional to Use it only on the First Post of a Thread, but what I don't know is if that Change can cause Problems on the Performance/Optimization of the Speed and Memory Use of the Displaying of the Posts on the Forum and on the Usage of the DataBase and of the Server. I had to Create that Plugin because on the Original One I received an Error that told me that on that Global Location I wasn't able to use those Variables that can be used without Problems on Hook Locations related with Postbit.

I/we Appreciate Your Guide.


Solution:


Step 1:

Create New Plugin.

Product: vBulletin
(if you create it on the "Topic Of The Week_Month Nomination" and you Update and overwrite the Product you'll lose this Plugin because it'll be Deleted)
(if you Disable or Uninstall the "Topic Of The Week_Month Nomination" Product you'll have to Disable this Plugin so that it don't cause Problems)

Name/Title: Topic Of The Week_Month Nomination - Live Topic Solution - Postbit_Display_Complete

Hook Place: Postbit_Display_Complete

Execution Order: 5

PHP Code:

Code:
if ($post['postid']==$this->thread['firstpostid'])

{


						if ($vbulletin->options['legacypostbit'])	{

							$vbulletin->templatecache['postbit_legacy'] = str_replace("<!-- / icon and title -->", $vbulletin->templatecache[nominate_topic_legacy_stamps]."<!-- / icon and title -->", $vbulletin->templatecache[postbit_legacy]);

						}
						else{

							$vbulletin->templatecache['postbit'] = str_replace(">&nbsp;</td>", ">&nbsp;</td>".$vbulletin->templatecache['nominate_topic_stamps'], $vbulletin->templatecache['postbit']);

						}


}
Notice the "nominate_topic_stamps", it'll Display the "Nominated Topic" or "Winner Topic" Logo and Link that is Created with the Template "nominate_topic_stamps", ONLY ON THE FIRST POST of the Thread, which is the Only One that is not Created via Quick Reply.

If you have Set your Mod Options to Nominate Any Post and Not Only the First One, then, if that Post is Nominated and is not the First One, then it'll Not Display the Top-Right Image that Says (Nominated and/or Winner TOTW TOTM), but the Below Options will Appear without any Problem, (the ones that Allow you to Retire your Nomination and Visit the Hall of Fame and the Nomination Thread).


Step 2:

Commenting the Previous Code Lines on the Plugin "Topic Of The Week_Month Nomination" Hook Location "global_setup_complete", which after the Changes will be like this:

Code:
if (THIS_SCRIPT === 'blog'){
						if ($vbulletin->options['nominate_topic_blog_on_off']){

							$vbulletin->templatecache['blog_entry_with_userinfo'] = str_replace("<!-- message -->", "<!-- message -->".$vbulletin->templatecache[nominate_topic_list_blog_stamps_box], $vbulletin->templatecache[blog_entry_with_userinfo]);
							$vbulletin->templatecache['blog_entry_without_userinfo'] = str_replace("<!-- message -->", "<!-- message -->".$vbulletin->templatecache[nominate_topic_list_blog_stamps_box], $vbulletin->templatecache[blog_entry_without_userinfo]);

							$vbulletin->templatecache['blog_show_entry'] = str_replace("<!-- ads could go here -->", "<!-- ads could go here -->".$vbulletin->templatecache[nominate_topic_blog_stamps_box], $vbulletin->templatecache[blog_show_entry]);
//							$vbulletin->templatecache['blog_show_entry'] = str_replace("<div style=\"clear:both; margin-top:10px\"></div>", "<div style='clear:both; margin-top:10px'></div>".$vbulletin->templatecache[nominate_topic_blog_button], $vbulletin->templatecache[blog_show_entry]);

							$string = htmlentities($vbulletin->templatecache['blog_show_entry'], ENT_QUOTES);

							$searchee = '<div style=\"clear:both; margin-top:10px\"></div>';
							$searchee = htmlspecialchars($searchee, ENT_QUOTES);
							$replace_by = $searchee.htmlentities($vbulletin->templatecache[nominate_topic_blog_button], ENT_QUOTES);
							$string = str_replace($searchee, $replace_by, $string);

							$searchee = '<div class=\"alt2 smallfont\" style=\"text-align:';
							$searchee = htmlspecialchars($searchee, ENT_QUOTES);
							$replace_by = htmlentities($vbulletin->templatecache[nominate_topic_blog_box], ENT_QUOTES).$searchee;
							$string = str_replace($searchee, $replace_by, $string);

							$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
							$string = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $string);
							$trans_tbl = get_html_translation_table(HTML_ENTITIES);
							$trans_tbl = array_flip($trans_tbl);
							$vbulletin->templatecache['blog_show_entry'] = strtr($string, $trans_tbl);
						}
					}
//					else {
//						if ($vbulletin->options['legacypostbit'])	{
//							$vbulletin->templatecache['postbit_legacy'] = str_replace("<!-- / icon and title -->", $vbulletin->templatecache[nominate_topic_legacy_stamps]."<!-- / icon and title -->", $vbulletin->templatecache[postbit_legacy]);
//						}
//						else{
//							$vbulletin->templatecache['postbit'] = str_replace(">&nbsp;</td>", ">&nbsp;</td>".$vbulletin->templatecache['nominate_topic_stamps'], $vbulletin->templatecache['postbit']);
//						}
//					}

					eval('$template_hook[navbar_search_menu] .= "' . fetch_template('nominate_topic_navbar_search') . '";');
					if ($vbulletin->options[nominate_topic_receiving_forumid]){
						eval('$template_hook[navbar_quick_links_menu_pos1] .= "' . fetch_template('nominate_topic_vbnav_quicklink') . '";');
					}
Notice the Commented Code Lines with the "//":

Code:
//					else {
//						if ($vbulletin->options['legacypostbit'])	{
//							$vbulletin->templatecache['postbit_legacy'] = str_replace("<!-- / icon and title -->", $vbulletin->templatecache[nominate_topic_legacy_stamps]."<!-- / icon and title -->", $vbulletin->templatecache[postbit_legacy]);
//						}
//						else{
//							$vbulletin->templatecache['postbit'] = str_replace(">&nbsp;</td>", ">&nbsp;</td>".$vbulletin->templatecache['nominate_topic_stamps'], $vbulletin->templatecache['postbit']);
//						}
//					}

Step 3:

ENJOY !!


I Hope for another Solution that could involve perhaps some small Changes on the Template "nominate_topic_stamps", so that both Mods can Work Fine on ALL Cases and on ALL Posts.

My Best Regards.

Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01527 seconds
  • Memory Usage 1,822KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete