vBulletin Tutorials

Solution: Post Thank You Hack v7.7 makes SQL error after upgrading to vB3.8.11

Submitted by treki, , Thread ID: 35092

Thread Closed
treki
Lurker
Level:
0
Reputation:
0
Posts:
1
Likes:
0
Credits:
2
27-05-2017, 02:08 AM
#1
Link to this mod: https://www.vbulletin.org/forum/showthread.php?t=165673

Error:
Invalid SQL:
SELECT * FROM vb_post_thanks AS post_thanks INNER JOIN vb_user AS user USING (userid) WHERE post_thanks.postid IN (0Array) ORDER BY post_thanks.username ASC;

MySQL Error : Unknown column '0Array' in 'where clause'
Error Number : 1054

Solution:

Making the following changes caused the Post Thanks hack to start working again on my 3.8.11 installation. Note: I haven't tested extensively beyond seeing that I could give thanks and delete it from one other member's post.

GIANT DISCLAIMER: I am not an expert coder. I occasionally muck around in PHP and sometimes understand what I'm doing.

Apply this fix AT YOUR OWN RISK. I can't help if it doesn't work for you.

The changes below refer to Post Thank You Hack version 7.6 only.

1) Back up a copy of your original 7.6 file in /forum/includes/functions_post_thanks.php in case this gets all screwed up.

2) Open the file in your favourite editor.

3) Starting at line 178, replace this...

Code:
if ($postids)
   {
     $post_ids = "0$postids";
   }
   else
   {
     $post_ids = $postid;
   }
... with this:

Code:
if (empty($postids))
   {
     $postids[] = $postid;
   }
4) A few lines below that (originally at line 189, but moved down due to the changes above), replace the this line ...

Code:
$thanks = $vbulletin->db->query_read("SELECT * FROM " .TABLE_PREFIX. "post_thanks AS post_thanks INNER JOIN " .TABLE_PREFIX. "user AS user USING (userid) WHERE post_thanks.postid IN (" . $post_ids . ") ORDER BY post_thanks.username ASC");
... with this:

Code:
$thanks = $vbulletin->db->query_read("SELECT * FROM " .TABLE_PREFIX. "post_thanks AS post_thanks INNER JOIN " .TABLE_PREFIX. "user AS user USING (userid) WHERE post_thanks.postid IN (" . implode(',', $postids) . ") ORDER BY post_thanks.username ASC");
5) A few lines below that (originally at line 193, but since moved further down due to the changes above), replace the this line ...

Code:
$thanks = $vbulletin->db->query_read("SELECT * FROM " .TABLE_PREFIX. "post_thanks WHERE postid IN (" . $post_ids . ") ORDER BY username ASC");
... with this:

Code:
$thanks = $vbulletin->db->query_read("SELECT * FROM " .TABLE_PREFIX. "post_thanks WHERE postid IN (" . implode(',', $postids) . ") ORDER BY username ASC");
6) Save & upload the file to /forum/includes.

Thx to vbem2

RE: Solution: Post Thank You Hack v7.7 makes SQL error after upgrading to vB3.8.11

TehJad
Closed Account
Level:
0
Reputation:
0
Posts:
13
Likes:
1
Credits:
15
06-08-2017, 06:32 AM
#2
Go vlog stop rapping, tryna ride the wave.

RE: Solution: Post Thank You Hack v7.7 makes SQL error after upgrading to vB3.8.11

redtin06
Novice
Level:
0
Reputation:
0
Posts:
20
Likes:
0
Credits:
0
08-01-2020, 02:13 PM
#3
I thank you, I search this alone but I had never found hhhhhhhhhhhh

Users browsing this thread: 1 Guest(s)