vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   [AJAX] Post Thank You Hack (https://vborg.vbsupport.ru/showthread.php?t=92410)

aranthorn 12-20-2005 04:31 PM

Quote:

Originally Posted by AnhTuanCool
Hey, nice hack there you made Abe1. /me clicked installed.

I made a modification to optimize the querying part of the hack as follow:
In plugin Post Thank You Hack at postbit_display_start, I'd changed:
PHP Code:

    $post_thanks_querys $db->query("SELECT postid FROM "TABLE_PREFIX ."post WHERE threadid = '$post[threadid]'");
    
$post_thanks_postids 0;
    
    while (
$post_thanks_query $db->fetch_array($post_thanks_querys))
    {
      
$post_thanks_postids .= ",$post_thanks_query[postid]";
    }

    
$post_thanks_cashe $db->query("SELECT * FROM " .TABLE_PREFIX"post_thanks WHERE postid IN ($post_thanks_postids) ORDER BY username ASC"); 

Into

PHP Code:

    $post_thanks_cashe $db->query("SELECT post_thanks.* FROM " TABLE_PREFIX "post_thanks, " TABLE_PREFIX "post WHERE post.postid = post_thanks.postid AND post.threadid = '$post[threadid]'"); 

It shortened the querying by one query, for some small or moderate boards, it doesn't make any noticeable different. But in any large board, it does help a lot.

You can include the mod if you want. Thanks for great hack! ;)

changed mine over, thanks :D

masterross 12-20-2005 09:05 PM

Quote:

Originally Posted by AnhTuanCool
Hey, nice hack there you made Abe1. /me clicked installed.

I made a modification to optimize the querying part of the hack as follow:
In plugin Post Thank You Hack at postbit_display_start, I'd changed:
PHP Code:

    $post_thanks_querys $db->query("SELECT postid FROM "TABLE_PREFIX ."post WHERE threadid = '$post[threadid]'");
    
$post_thanks_postids 0;
    
    while (
$post_thanks_query $db->fetch_array($post_thanks_querys))
    {
      
$post_thanks_postids .= ",$post_thanks_query[postid]";
    }

    
$post_thanks_cashe $db->query("SELECT * FROM " .TABLE_PREFIX"post_thanks WHERE postid IN ($post_thanks_postids) ORDER BY username ASC"); 

Into

PHP Code:

    $post_thanks_cashe $db->query("SELECT post_thanks.* FROM " TABLE_PREFIX "post_thanks, " TABLE_PREFIX "post WHERE post.postid = post_thanks.postid AND post.threadid = '$post[threadid]'"); 

It shortened the querying by one query, for some small or moderate boards, it doesn't make any noticeable different. But in any large board, it does help a lot.

You can include the mod if you want. Thanks for great hack! ;)

i've change too but get:
Database error in vBulletin 3.5.2:

Invalid SQL:
SELECT post_thanks.* FROM vb_post_thanks, vb_post WHERE post.postid = post_thanks.postid AND post.threadid = '43120';

MySQL Error : Unknown table 'post_thanks'
Error Number : 1051

AnhTuanCool 12-21-2005 03:20 PM

materros - Replace this line in that same plugin (Post Thank You Hack at postbit_display_start hook location)

PHP Code:

$post_thanks_cashe $db->query("SELECT post_thanks.* FROM " TABLE_PREFIX "post_thanks, " TABLE_PREFIX "post WHERE post.postid = post_thanks.postid AND post.threadid = '$post[threadid]'"); 

OR (if you haven't applied the change from post 310 of mine)

PHP Code:

 $post_thanks_querys $db->query("SELECT postid FROM "TABLE_PREFIX ."post WHERE threadid = '$post[threadid]'");
    
$post_thanks_postids 0;
    
    while (
$post_thanks_query $db->fetch_array($post_thanks_querys))
    {
      
$post_thanks_postids .= ",$post_thanks_query[postid]";
    }

    
$post_thanks_cashe $db->query("SELECT * FROM " .TABLE_PREFIX"post_thanks WHERE postid IN ($post_thanks_postids) ORDER BY username ASC"); 

To

PHP Code:

$post_thanks_cashe $db->query("SELECT " TABLE_PREFIX "post_thanks.* FROM " TABLE_PREFIX "post_thanks, " TABLE_PREFIX "post WHERE post.postid = post_thanks.postid AND post.threadid = '$post[threadid]' ORDER BY " TABLE_PREFIX "post_thanks.username ASC"); 

That should fix it. Good luck ;)

masterross 12-22-2005 05:14 PM

thanks for the update
after applied a little bit different error: :)
Database error in vBulletin 3.5.2:

Invalid SQL:
SELECT vb_post_thanks.* FROM vb_post_thanks, vb_post WHERE post.postid = post_thanks.postid AND post.threadid = '44699' ORDER BY vb_post_thanks.username ASC;

MySQL Error : Unknown table 'post' in where clause
Error Number : 1109
Date : Thursday, December 22nd 2005 @ 09:10:17 PM

masterross 12-22-2005 05:16 PM

i forgot to tell that i have table prefix - "vb_"

BR,
Ross

Abe1 12-22-2005 05:17 PM

Quote:

Originally Posted by masterross
thanks for the update
after applied a little bit different error: :)
Database error in vBulletin 3.5.2:

Invalid SQL:
SELECT vb_post_thanks.* FROM vb_post_thanks, vb_post WHERE post.postid = post_thanks.postid AND post.threadid = '44699' ORDER BY vb_post_thanks.username ASC;

MySQL Error : Unknown table 'post' in where clause
Error Number : 1109
Date : Thursday, December 22nd 2005 @ 09:10:17 PM

Here: Use this.
PHP Code:

$post_thanks_cashe $db->query("SELECT " TABLE_PREFIX "post_thanks.* FROM " TABLE_PREFIX "post_thanks, " TABLE_PREFIX "post WHERE " TABLE_PREFIX "post.postid = post_thanks.postid AND " TABLE_PREFIX "post.threadid = '$post[threadid]' ORDER BY " TABLE_PREFIX "post_thanks.username ASC"); 


masterross 12-22-2005 09:05 PM

sorry guys...
again prob:

Database error in vBulletin 3.5.2:

Invalid SQL:
SELECT vb_post_thanks.* FROM vb_post_thanks, vb_post WHERE vb_post.postid = post_thanks.postid AND vb_post.threadid = '44699' ORDER BY vb_post_thanks.username ASC;

MySQL Error : Unknown table 'post_thanks' in where clause
Error Number : 1109

masterross 12-22-2005 09:15 PM

i've handled it :))
thanks to Abe1 !

i've added everywhere - " . TABLE_PREFIX . "

and here is the final strings:

$post_thanks_cashe = $db->query("SELECT " . TABLE_PREFIX . "post_thanks.* FROM " . TABLE_PREFIX . "post_thanks, " . TABLE_PREFIX . "post WHERE " . TABLE_PREFIX . "post.postid = " . TABLE_PREFIX . "post_thanks.postid AND " . TABLE_PREFIX . "post.threadid = '$post[threadid]' ORDER BY " . TABLE_PREFIX . "post_thanks.username ASC");

Abe1 12-23-2005 12:14 AM

Quote:

Originally Posted by masterross
sorry guys...
again prob:

Database error in vBulletin 3.5.2:

Invalid SQL:
SELECT vb_post_thanks.* FROM vb_post_thanks, vb_post WHERE vb_post.postid = post_thanks.postid AND vb_post.threadid = '44699' ORDER BY vb_post_thanks.username ASC;

MySQL Error : Unknown table 'post_thanks' in where clause
Error Number : 1109

Yup, forgot one place.
PHP Code:

$post_thanks_cashe $db->query("SELECT " TABLE_PREFIX "post_thanks.* FROM " TABLE_PREFIX "post_thanks, " TABLE_PREFIX "post WHERE " TABLE_PREFIX "post.postid = " TABLE_PREFIX "post_thanks.postid AND " TABLE_PREFIX "post.threadid = '$post[threadid]' ORDER BY " TABLE_PREFIX "post_thanks.username ASC"); 


lolo? 12-27-2005 10:17 AM

works great thanks for this hack :p
i have one suggestion
it's possible to bump a thread when a member use the thanks button like a basic answer ?
hum i hope you understand
sorry for my bad english


All times are GMT. The time now is 04:04 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.01480 seconds
  • Memory Usage 1,789KB
  • 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
  • (9)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
  • (3)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