vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Miscellaneous Hacks - Live Topic - AJAX (https://vborg.vbsupport.ru/showthread.php?t=201697)

Coders Shack 02-04-2009 06:14 PM

Quote:

Originally Posted by patsfans (Post 1732426)
Thank you. It looks like that link wasn't added in my navbar on the install. But I'm satisfied with your default, and as I said my users enjoyed it as well. We had nearly 300 people active in one thread last night and it worked incredibly well. So again, thank you for putting it together :)

happy to hear this :)

inciarco 02-05-2009 04:02 PM

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 !! :p


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. :rolleyes:

My Best Regards. ;)

:)

inciarco 02-05-2009 05:41 PM

One Question About the "N New Messages (Live Topic)" Message on the Bottom-Right Corner of the Window:

I noticed that if I access a Dead Topic (with FireFox) and I place myself on one of the Pages of the Thread, (Not the Last One), and some User Come and Post a Reply to the Thread (gets the Topic Live), then for the User that Accessed the Topic while it was Dead this Message is Displayed.

Seems like that Particular Code of that Message is Still Active even if the Topic is Dead. Is this the way is Designed to Work or perhaps is a Bug and that Code is not supposed to Work if the Topic is Dead or if it Gets Dead after the X Minutes Specified for it to Die? :confused:

Edit: Idea: If it is supposed to work like that, then I think that if a Topic Dies and a User is in the Last Page of that Thread, then that Message Should Display to that User to Tell Him/Her that the Topic Have New Messages and for Him/Her to be able to Browse to see them. (This moment if the User is in the Last Page of the Thread while it is Dead, Nothing Happens, but if the User is in any other Page happens what is previously Described) ;)

My Best Regards.

:)

inciarco 02-06-2009 03:12 AM

I Forgot to Mentione it. :o

I Nominated this Mod for MOTM, is a Great Mod. :up::up::up:

My Best Regards.

:)

Nightmare-GameZ 02-06-2009 10:36 AM

woopdeedoo! This add-on is cool! xD Installed!

Coders Shack 02-08-2009 01:56 AM

Quote:

Originally Posted by inciarco (Post 1735389)
One Question About the "N New Messages (Live Topic)" Message on the Bottom-Right Corner of the Window:

I noticed that if I access a Dead Topic (with FireFox) and I place myself on one of the Pages of the Thread, (Not the Last One), and some User Come and Post a Reply to the Thread (gets the Topic Live), then for the User that Accessed the Topic while it was Dead this Message is Displayed.

Seems like that Particular Code of that Message is Still Active even if the Topic is Dead. Is this the way is Designed to Work or perhaps is a Bug and that Code is not supposed to Work if the Topic is Dead or if it Gets Dead after the X Minutes Specified for it to Die? :confused:

Edit: Idea: If it is supposed to work like that, then I think that if a Topic Dies and a User is in the Last Page of that Thread, then that Message Should Display to that User to Tell Him/Her that the Topic Have New Messages and for Him/Her to be able to Browse to see them. (This moment if the User is in the Last Page of the Thread while it is Dead, Nothing Happens, but if the User is in any other Page happens what is previously Described) ;)

My Best Regards.

:)

I'm not sure why you guys are getting bad notices.

But yea the notice system is only in place if your on a page other than the last page of the thread and the actual topic is active. The nice will stay up. I will add logic to hide the notice once it stops checking for new posts. But currently once it sees that the topic is dead it stops making calls.

inciarco 02-08-2009 05:29 AM

Quote:

Originally Posted by Coders Shack (Post 1737459)
I'm not sure why you guys are getting bad notices.

But yea the notice system is only in place if your on a page other than the last page of the thread and the actual topic is active. The nice will stay up. I will add logic to hide the notice once it stops checking for new posts. But currently once it sees that the topic is dead it stops making calls.

Actually that's the Bug, for some reason the Notice System Keeps Tracking for New Posts, even if the Thread is Dead; I made lots of Tests about this issue and All the Times when an User Accessed a Dead Thread and X Minutes Later another User Posted a Message and Activated the Thread, then the Other User (that Accessed the Thread when it was Dead), Started Getting Notices about the New Posts. That makes me think that the Notice System is Active All the Time and Consuming Resources. :confused: I also made the same Test by letting the User to Stay in the Thread for some minutes after it Goy Dead, and then Other User to Access the Thread and Start Posting Messages, and then the Other User Started Getting Notice Messaged, which also makes me think that the Notice System was Active even if the Thread was Dead. :confused:

About the Code to Partially Solve (in my Case 100% because I Only Nominate Threads / First Posts) the Problem with the Mod to Nominate Topics, what do You Think about it? :confused: Would it cause any Considerable Extra Server Load or is it a Normal Code in terms of Server Load? :confused:

My Best Regards. ;)

:)

TitanJeff 02-09-2009 09:53 PM

Hmmmm... doesn't work for me in 3.7.3.

Would love it though.

MTGDarkness 02-14-2009 09:14 AM

This is really cool.

Jari37 02-14-2009 05:35 PM

Working perfectly up to now in 3.7.1. Brilliant work, much appreciated.


All times are GMT. The time now is 10:07 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.01239 seconds
  • Memory Usage 1,802KB
  • 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
  • (3)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete