vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Show Thread Enhancements - [AJAX] Post Thank You Hack (https://vborg.vbsupport.ru/showthread.php?t=231666)

ExcelFox 05-15-2011 03:47 PM

1 Attachment(s)
A great mod, and I am already liking its use very much, and am thankful for developers like yourselves taking out time and effort, to provide us with such free modifications and add-ons.

With due respect, there is a small bug fix that would be nice (which should be a stroll in the park for coders like you). The issue is in the postbit, when this mod is used with ITW - Time Spent Online. So what happens is that the time online is displayed along with the X Thanks in X Posts line which makes reading confusing. If this is not clear, I have posted an image. You could have a look. Thanks again for your time.

For the time being, I have disabled showing the Thank You, but I would really love to have this working.

ExcelFox 05-15-2011 08:07 PM

Took me 3 hours to make my first ever modification in my life. And guess what! It's a success. Not sure how many eyebrows raise if this is a stupid way to make a modification, but hey, I got it all working for me at least.

Well, just in case somebody faces this problem, you can replace the code in the post_thanks_postbit_info style with the one below

PHP Code:

<vb:if condition="$post['userid']">
    <
dt>{vb:rawphrase post_thanks_thanks}</dt> <dd>{vb:raw post.post_thanks_user_amount_formatted}</dd>
    <
vb:if condition="$post['post_thanks_thanked_times'] == 1">
        <
dd>{vb:rawphrase post_thanks_time_post}</dd>
    <
vb:elseif condition="$post['post_thanks_thanked_posts'] == 1" />
        <
dd>{vb:rawphrase post_thanks_times_post, {vb:raw post.post_thanks_thanked_times_formatted}}</dd>
    <
vb:else />
        <
dd>{vb:rawphrase post_thanks_times_posts, {vb:raw post.post_thanks_thanked_times_formatted}, {vb:raw post.post_thanks_thanked_posts_formatted}}</dd>
    </
vb:if>
</
vb:if> 


channelfuse 05-17-2011 01:17 PM

1 Attachment(s)
Here's the fix for the searching. Replace post_thanks.php with this file.

What was wrong:
It was looking in an old table 'search' for the results. This no longer works.

What was fixed:
I have the initial SQL statement grab the thread IDs and post IDs:
PHP Code:

$posts $db->query_read("
            SELECT postid, post.threadid as threadid 

Then, we need to throw them into an array:
PHP Code:

while ($post $db->fetch_array($posts))
        {
            
$orderedids[] = array("1"$post['postid'], $post['threadid']);
        } 

The old code is commented out in other areas.

Then, we need to create our query to match the way vB 4.x wants it.
PHP Code:

$scriteria $search_core->create_criteria(vB_Search_Core::SEARCH_ADVANCED);
        
$scriteria->set_advanced_typeid($vbulletin->GPC['contenttypeid']);
        
$scriteria->set_grouped(vB_Search_Core::GROUP_NO);
        
$crit "'" $db->escape_string(serialize($scriteria)) . "'";
        
$hash "'" $db->escape_string($scriteria->get_hash()) . "'";
                    
//results, confirmed, groups_seen, groups_rejected
        
$sresults serialize(array($orderedids"0", array(), array()));
        
$db->query_write("
            INSERT INTO " 
TABLE_PREFIX "searchlog (userid, ipaddress, searchhash, sortby, sortorder, searchtime, dateline, completed, criteria, results)
            VALUES (" 
$vbulletin->userinfo['userid'] . ", '" $db->escape_string(IPADDRESS) . "', $hash, 'groupdateline', 'desc', '0.999', UNIX_TIMESTAMP(NOW()), 1, $crit, '$sresults')");
        
$searchid $db->insert_id(); 

We create our search criteria, serialize it and then get the hash of it. We then serialize our IDs. The way vB's results.php wants the results is ordered such as:

array of threadIDs/postIDs
number of 'confirmed' posts (No idea what this is, left it as 0).
array of groups seen (No idea on this, just make an empty array).
array of groups denied (Again, no clue. Just made an empty array).

We then insert the data into the searchlog table and use that to generate the search results. I also included some various files at the beginning and setup a variable for the whole search thing:
PHP Code:

require_once(DIR "/vb/search/core.php");
require_once(
DIR "/vb/search/resultsview.php");

$search_core vB_Search_Core::get_instance(); 

That's it. Searching via User CP should work.

Vaira 05-17-2011 04:05 PM

Thanks a lot for your efforts. :)
Do I have to use the fixed version first (post_thanks_7_82.fixed.zip ) and then replace the original one with your post_thanks.php?
Or do I have to use abe1's original version and then replace the post_thanks.php?

https://vborg.vbsupport.ru/showpost....postcount=1433
I am confused since the fixed version has an updated version of post_thanks.js (besides of the product-post_thanks.xml). Is that updated post_thanks.js needed in order to run properly or should I use abe1's original one?

ATM I am running the fixed version from the link above.

Do the recounters options work?

Thanks again.

channelfuse 05-17-2011 06:50 PM

Quote:

Originally Posted by Vaira (Post 2196795)
Thanks a lot for your efforts. :)
Do I have to use the fixed version first (post_thanks_7_82.fixed.zip ) and then replace the original one with your post_thanks.php?
Or do I have to use abe1's original version and then replace the post_thanks.php?

https://vborg.vbsupport.ru/showpost....postcount=1433
I am confused since the fixed version has an updated version of post_thanks.js (besides of the product-post_thanks.xml). Is that updated post_thanks.js needed in order to run properly or should I use abe1's original one?

ATM I am running the fixed version from the link above.

Do the recounters options work?

Thanks again.

My code is based off of the original 7.82. I'm not sure what was changed in 7.82-fixed as the original code still worked (just a few minor cosmetic tweaks for our forum). I'll take a look at the difference between the two and report back.

Edit: It appears his fix was only in the .xml file. Mine was only in the .php. They should work just fine. You can use 7.82-fixed and overwrite the post_thanks.php with my file.

billstelling 05-17-2011 09:30 PM

Quote:

Originally Posted by djbaxter (Post 2195703)
Similar experience: I had to restore my forum from a day old backup after uninstalling one of their mods.



One option is to try https://vborg.vbsupport.ru/showthread.php?t=228507 instead of SSTab. I found that to be a little less finicky.

To change it manually, I think this should do it:

1. Admin CP >> Styles & Templates >> Style Manager >> {your style} >> Edit Templates

2. Find and edit Navigation / Breadcrumb Templates >> navbar

3. Find and comment out or delete:

PHP Code:

<li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post">{vb:rawphrase new_posts_nav}</a></li

4. Save

thanks DJ, appreciate the input, it was helpful.:D

midnz 05-17-2011 09:31 PM

Awesome stuff channelfuse!! I'm glad I hung on to this hack. It works perfectly now. Thank-you very much indeed :)

billstelling 05-17-2011 09:39 PM

Quote:

Originally Posted by Gradonil_Ral (Post 2195709)
Which doesn't work with the current vBulletin, yeah.

works fine for me in vB 4.1.3
all you have to do is edit this.
Code:

                <dependency dependencytype="vbulletin" minversion="4.0.0 beta 4" maxversion="4.1.0 alpha 1" />
to

Code:

                <dependency dependencytype="vbulletin" minversion="4.0.0 beta 4" maxversion="4.9.99" />
you could change it to 4.1.3 if you wanted but you would need to change it to the current version every time you upgraded vB.

sadiq6210 05-18-2011 09:21 AM

Quote:

Originally Posted by channelfuse (Post 2196762)
Here's the fix for the searching. Replace post_thanks.php with this file.

What was wrong:
It was looking in an old table 'search' for the results. This no longer works.

What was fixed:
I have the initial SQL statement grab the thread IDs and post IDs:
PHP Code:

$posts $db->query_read("
            SELECT postid, post.threadid as threadid 

Then, we need to throw them into an array:
PHP Code:

while ($post $db->fetch_array($posts))
        {
            
$orderedids[] = array("1"$post['postid'], $post['threadid']);
        } 

The old code is commented out in other areas.

Then, we need to create our query to match the way vB 4.x wants it.
PHP Code:

$scriteria $search_core->create_criteria(vB_Search_Core::SEARCH_ADVANCED);
        
$scriteria->set_advanced_typeid($vbulletin->GPC['contenttypeid']);
        
$scriteria->set_grouped(vB_Search_Core::GROUP_NO);
        
$crit "'" $db->escape_string(serialize($scriteria)) . "'";
        
$hash "'" $db->escape_string($scriteria->get_hash()) . "'";
                    
//results, confirmed, groups_seen, groups_rejected
        
$sresults serialize(array($orderedids"0", array(), array()));
        
$db->query_write("
            INSERT INTO " 
TABLE_PREFIX "searchlog (userid, ipaddress, searchhash, sortby, sortorder, searchtime, dateline, completed, criteria, results)
            VALUES (" 
$vbulletin->userinfo['userid'] . ", '" $db->escape_string(IPADDRESS) . "', $hash, 'groupdateline', 'desc', '0.999', UNIX_TIMESTAMP(NOW()), 1, $crit, '$sresults')");
        
$searchid $db->insert_id(); 

We create our search criteria, serialize it and then get the hash of it. We then serialize our IDs. The way vB's results.php wants the results is ordered such as:

array of threadIDs/postIDs
number of 'confirmed' posts (No idea what this is, left it as 0).
array of groups seen (No idea on this, just make an empty array).
array of groups denied (Again, no clue. Just made an empty array).

We then insert the data into the searchlog table and use that to generate the search results. I also included some various files at the beginning and setup a variable for the whole search thing:
PHP Code:

require_once(DIR "/vb/search/core.php");
require_once(
DIR "/vb/search/resultsview.php");

$search_core vB_Search_Core::get_instance(); 

That's it. Searching via User CP should work.

WoooooooW Finally :D

Great job "channelfuse"

You make me very happy when I read your great post
Work like a charm
Appreciate your help and you time consumed on that

Keep it up :up::up::up:

sadiq6210 05-18-2011 09:24 AM

I think by solve searching bug, this hack become live again
I have suggestion If any one can think about it

(Notification when receive new thank)

Will be a great feature


All times are GMT. The time now is 02:54 PM.

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.05372 seconds
  • Memory Usage 1,838KB
  • 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
  • (10)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (6)pagenav_pagelinkrel
  • (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