vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Automatic 'Thank you' Hack (https://vborg.vbsupport.ru/showthread.php?t=63368)

Mone' 04-04-2004 11:31 PM

wow my post jump on second page !??! bloody server time.....

calvinnguyen 04-05-2004 12:19 AM

I had no ideas why it keep give me a message no permission to access when I click on the button Thank You. I have install exactly intruction for many times, again and again. Still didn't work. This is the hack that I have looking for more than 1 year. Now you release it, but I can't sucessful to install it :tired:

tnguy3n 04-05-2004 12:35 AM

Quote:

Originally Posted by VBDev
Isn't it was is written ? I don't understand what you want to say

I was just wondering why adding $thanks_post template to postbit_legacy but not to postbit template. well, maybe it works either way. :squareeyed:

Boofo 04-05-2004 01:00 AM

It needs to be added to both of them. ;)

calvinnguyen 04-05-2004 01:00 AM

I have try to play with this hack around my forum, but still didn't work. I am not lucky guy for this hack.

tnguy3n 04-05-2004 03:27 AM

Quote:

Originally Posted by calvinnguyen
I have try to play with this hack around my forum, but still didn't work. I am not lucky guy for this hack.

Those no permission messages appear cuz you don't have "Thank You Option" enable for existing forums. Just run this following query (in either Admin CP or phpMyAdmin):
Quote:

UPDATE `forum` SET `showthanks` = '1', `showthanks_date` = '1' ;

teksigns 04-05-2004 03:44 AM

Quote:

1 if you delete a thread with a thank you post the thank you talbe doen not get deleted in the db. Can you add the function to remove the db entry if a thread get deleted?

i fixed this myself


in :

includes/functions_databuild.php

Find:

Code:

        delete_post_index($post['postid']); //remove search engine entries
                        }
                }

                if (!empty($userbyuserid) AND !$threadinfo['isdeleted'])
                { // if the thread is already deleted, the posts have already been reduced


add this right above it :


Code:

$DB_site->query("DELETE FROM " . TABLE_PREFIX . "thanks WHERE threadid=$threadid");
save and your done !


now anytime you Physically remove it it will also remove the thanks.

Mone' 04-05-2004 05:24 AM

thx for that :)

VBDev 04-05-2004 09:48 AM

Quote:

Originally Posted by tnguy3n
I was just wondering why adding $thanks_post template to postbit_legacy but not to postbit template. well, maybe it works either way. :squareeyed:

In postbit AND postbit_legacy templates

@teksigns vbmenu_register("postmenu_495736", true); : Thanks for this ;)

@Mone' : You registered on vbulletindev, but it seems you had a lot of SQL error due to your username (the ' ), these are vBulletin's bugs

I'll correct it adding addslashed into SQL queries ;) Try to connect later, it should be ok

subu1 04-05-2004 12:30 PM

great Hack, but i have a Problem :rolleyes:

In SHOWTHREAD template, find (you must do it 2 times) :

------------------------------------------------------------------------
<if condition="$show['largereplybutton']">
<td class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$FIRSTPOSTID"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" ></if></a></td>
</if>
------------------------------------------------------------------------


and replace with :

------------------------------------------------------------------------
<if condition="$show['largereplybutton']">
<td class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$FIRSTPOSTID"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" ></if></a></td>
</if>
<td class="smallfont" align="right"><a href="newreply.php?do=thanks&amp;threadid=$thread[threadid]">
<img src="$stylevar[imgdir_button]/thanks.gif" alt="$vbphrase[thanks]" border="0" >
</a></td>

i don't have this, i have this :rolleyes:

<if condition="$show['largereplybutton']">
<td class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply&noquote=1&p=$FIRSTPOSTID"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" ></if></a>

<a href="newthread.php?$session[sessionurl]do=newthread&f=$foruminfo[forumid]"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" />

</td>

please can you help me :surprised:

Boofo 04-05-2004 12:33 PM

Look for this then. ;)

HTML Code:

<td class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply

Boofo 04-05-2004 12:36 PM

Quote:

Originally Posted by teksigns
i fixed this myself


in :

includes/functions_databuild.php

Find:

Code:

        delete_post_index($post['postid']); //remove search engine entries
                        }
                }

                if (!empty($userbyuserid) AND !$threadinfo['isdeleted'])
                { // if the thread is already deleted, the posts have already been reduced


add this right above it :


Code:

$DB_site->query("DELETE FROM " . TABLE_PREFIX . "thanks WHERE threadid=$threadid");
save and your done !


now anytime you Physically remove it it will also remove the thanks.

What if there isn't a thanks message in the thread you want to delete. Wouldn't that give you a db error? ;)

teksigns 04-05-2004 01:50 PM

Quote:

What if there isn't a thanks message in the thread you want to delete. Wouldn't that give you a db error?

not it would not .....


i just deletes any it finds ....if none match then it just continues .......

Boofo 04-05-2004 01:54 PM

It deletes any it finds, or finds for that thread you mean? ;)

subu1 04-05-2004 02:23 PM

Quote:

Originally Posted by Boofo
Look for this then. ;)

HTML Code:

<td class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply

Hi Boofo

Sorry, but you can write me the code please, view can see that I after something other I also, but how it goes.

teksigns 04-05-2004 02:39 PM

Quote:

Originally Posted by Boofo
It deletes any it finds, or finds for that thread you mean? ;)



find for that thread ..........

teksigns 04-05-2004 02:43 PM

heres another wish filled .....


Quote:

2 ability to bump a post when a user say thank you

with this each time someone clicks thankyou your post will be bumped to the
top of the list again ......


in newreply.php
Find this :

Code:

        $DB_site->query("
        INSERT INTO ". TABLE_PREFIX ."thanks
        (userid, username, date, threadid)
        VALUES ('$bbuserinfo[userid]', '" . addslashes($bbuserinfo[username]) . "', " . TIMENOW . ", '$threadid')");


bellow it , add this :

Code:

$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET lastpost=".TIMENOW." WHERE threadid='".$threadid."'");

thats it !


your done ......

Boofo 04-05-2004 02:45 PM

LOL How many queries is all of this adding?

teksigns 04-05-2004 02:50 PM

Quote:

Originally Posted by Boofo
LOL How many queries is all of this adding?


just trying to help !


im not a coder... if you have better way .....please post it .......

its only way i know to get job done .......

subu1 04-05-2004 02:55 PM

...what a Mod :(

Boofo 04-05-2004 02:56 PM

Quote:

Originally Posted by teksigns
just trying to help !


im not a coder... if you have better way .....please post it .......

its only way i know to get job done .......

I didn't me that in a bad way. I was jusy saying that adding too many queries might not be a good idea to some poeple. Sorry if you took that wrong. ;)

teksigns 04-05-2004 02:58 PM

Quote:

Originally Posted by Boofo
I didn't me that in a bad way. I was jusy saying that adding too many queries might not be a good idea to some poeple. Sorry if you took that wrong. ;)


np .....

i wish there was another way ..... but none i can think of without the extra
queries .......

calvinnguyen 04-06-2004 01:39 AM

Quote:

Originally Posted by tnguy3n
Those no permission messages appear cuz you don't have "Thank You Option" enable for existing forums. Just run this following query (in either Admin CP or phpMyAdmin):

How can I clear #1060 - Duplicate column name 'showthanks'
to run
ALTER TABLE `forum` ADD `showthanks` INT(1) DEFAULT '0' NOT NULL;

again, because anytime I run it give me error as the message below.
Thanks tnguy3n

Error

SQL-query :

ALTER TABLE `forum` ADD `showthanks` INT( 1 ) DEFAULT '0' NOT NULL

MySQL said:


#1060 - Duplicate column name 'showthanks'

Boofo 04-06-2004 02:13 AM

That error means that column is already there. You do not need to run that query again. ;)

calvinnguyen 04-06-2004 03:19 AM

Quote:

Originally Posted by Boofo
That error means that column is already there. You do not need to run that query again. ;)

I don't know what the heck exactly wrong with my database. It keeps give me a message that:

you do not have permission to access this page. This could be due to one of several reasons:

Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.


I HAVE READ THIS INTRUCTION FOR MANY TIMES EVEN I got sucessful when Run SQL query/queries on database.
From tnguy3n told me for his help, but it is still not working..
What is exactly wrong about it.

tnguy3n 04-06-2004 03:50 AM

Quote:

Originally Posted by calvinnguyen
I don't know what the heck exactly wrong with my database. It keeps give me a message that:

you do not have permission to access this page. This could be due to one of several reasons:

Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.


I HAVE READ THIS INTRUCTION FOR MANY TIMES EVEN I got sucessful when Run SQL query/queries on database.
From tnguy3n told me for his help, but it is still not working..
What is exactly wrong about it.

Run this query:
Code:

UPDATE `forum` SET `showthanks` = '1', `showthanks_date` = '1' ;

calvinnguyen 04-06-2004 04:42 AM

Quote:

Originally Posted by tnguy3n
Run this query:
Code:

UPDATE `forum` SET `showthanks` = '1', `showthanks_date` = '1' ;

I run this query already, but the problem is the same.

tnguy3n 04-06-2004 05:31 AM

I tested this on my localhost and it seemed to work fine. I think I got that "No Permission Message" too, but then I updated that "thank you" option for forums (by running that query) and i got it to work.
(hey, i noticed you got the same last name as mine ;) )

VitroX 04-06-2004 12:37 PM

Quote:

Originally Posted by VitroX
this is a great hack.

how about adding the total pple who thank the thread starter?

something like:

5 Users already said Thank You!:

username1, username2, username3, username4, username5


it would fit better for my forum.

Thanks for your work!

How do I add a counter to show the total number of members who made the "Thanks"??

Thanks

VBDev 04-06-2004 04:40 PM

I'll do it Vitrox ;)

teksigns 04-06-2004 05:13 PM

Quote:

Originally Posted by VBDev
I'll do it Vitrox ;)


cool !


cant wait

calvinnguyen 04-06-2004 11:40 PM

Quote:

Originally Posted by VBDev
@calvin : where do you get this no_permission screen ? If you have it when you click the button Thanks, it's coz you are not logged in
Prefix : look in your config.php, $prefix=... you have to add in my SQL queries, the prefix before tables name

I update the zip

I had run those 3 below got sucessful, but still got no_permission screen like you said above.
What do you mean add ,$prefix = ' '; to my SQL?

even I add this: $prefix = ' '; before tables name . It is still not going. I had no ideas what is exactly wrong to cause this problem. I love this hack, but I am not lucky to use it. :disappointed:


ALTER TABLE `forum` ADD `showthanks` INT(1) DEFAULT '0' NOT NULL;

ALTER TABLE `forum` ADD `showthanks_date` INT(1) DEFAULT '0' NOT NULL;

CREATE TABLE `thanks` (
`id` INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`userid` INT(10) NOT NULL,
`username` VARCHAR(50) NOT NULL,
`date` INT(10) NOT NULL,
`threadid` INT(10) NOT NULL
);

Mone' 04-09-2004 05:25 PM

Quote:

Originally Posted by VBDev
I'll do it Vitrox ;)

exellent :squareeyed:

Boofo 04-09-2004 06:02 PM

VBDev, buddy, are you still working on this hack? ;)

VBDev 04-09-2004 06:04 PM

No, I'm finishing an other one, 'hidden text password protected' in post :)

I take a look for this counter in the evening ;)

VBDev 04-09-2004 09:00 PM

@ calvin : I've exactly the same problem ... this no_permission page, really strange, the var $foruminfo[showthanks] doesn't seen working

I correct it before doing the counter


If you have this no_permission problem, replace the code to add in newreply.php with :


PHP Code:

// ############################### Than you hack Grog6 ###############################
if ($_REQUEST['do'] == 'thanks')
{
    
globalize($_REQUEST, array('threadid' => INT));
    
$forum=$DB_site->query_first("SELECT showthanks FROM "TABLE_PREFIX ."forum WHERE forumid='$foruminfo[forumid]'");
    if (
$forum[showthanks]==|| $bbuserinfo[userid]==0)
     
print_no_permission();
    else
    {
        
$verif=$DB_site->query_first("SELECT userid FROM "TABLE_PREFIX ."thanks WHERE threadid='$threadid' AND userid='$bbuserinfo[userid]'");
    if (
$verif[userid]==$bbuserinfo[userid])
     eval(
print_standard_error('error_already_thanks'));
    else
        {
        
$DB_site->query("
        INSERT INTO "
TABLE_PREFIX ."thanks
        (userid, username, date, threadid)
        VALUES ('
$bbuserinfo[userid]', '" addslashes($bbuserinfo[username]) . "', " TIMENOW ", '$threadid')");
        
$url "showthread.php?$session[sessionurl]t=$threadid";
    eval(
print_standard_redirect('redirect_thanks'));
        }
    }



And code to add in functions_showthread.php with :

PHP Code:

         // thank you hack grog6
        
$cmpt=1;
        
$grumpf=$DB_site->query_first("SELECT showthanks FROM "TABLE_PREFIX ."forum WHERE forumid='$forum[forumid]'");
    
        if (
$grumpf[showthanks] == && $post[postcount]==1)
        {
        
$thanks=$DB_site->query("SELECT * FROM "TABLE_PREFIX ."thanks WHERE threadid='$thread[threadid]' ORDER BY username");
        
$nb=$DB_site->num_rows($thanks);
        if (
$nb>0)
           {
               while(
$thank=$DB_site->fetch_array($thanks))
               {
                if (
$cmpt<$nb)
                 
$virg=",";
                else 
$virg="";
                if (
$forum[showthanks_date]==0)
                
$liste_user $liste_user." <a href=\"member.php?u=$thank[userid]\">$thank[username]</a>$virg ";
                else
                {
                 
$date_thank vbdate($vboptions['dateformat'], $thank['date'], true);
                 
$liste_user $liste_user." <a href=\"member.php?u=$thank[userid]\">$thank[username]</a> ($date_thank)$virg ";
                }
               
$date=$thank[date];
               
$cmpt++;
              }
               
// format date/time
            
$post['postdate'] = vbdate($vboptions['dateformat'], $datetrue);
            
$post['posttime'] = vbdate($vboptions['timeformat'], $date);
               
// user profil field
               
$username "<b><font size=\"3\">$vbphrase[thanks_bot]</font></b>";
               if (
$nb<=1)
                
$thank_phrase construct_phrase($vbphrase[thanks_1_install], $post[musername]);
               else 
$thank_phrase construct_phrase($vbphrase[thanks_x_install], $post[musername]);
               if (
$vboptions[legacypostbit]=="000")
                eval(
'$thanks_post .= " ' fetch_template('thanks_postbit') . '";');
               else eval(
'$thanks_post = " ' fetch_template('thanks_postbit_legacy') . '";');
             }
        }
        
// thank you hack grog6 


VBDev 04-09-2004 09:27 PM

To add a counter, in functions_showthread.php, replace :


PHP Code:

$thanks=$DB_site->query("SELECT * AS nb FROM "TABLE_PREFIX ."thanks WHERE threadid='$thread[threadid]' ORDER BY username"); 

with


PHP Code:

$thanks=$DB_site->query("SELECT *, COUNT(userid) AS nb FROM "TABLE_PREFIX ."thanks WHERE threadid='$thread[threadid]' GROUP BY userid ORDER BY username"); 

Add a phrase in your phrase manager thanks_nb :

Code:

{1} people have clicked the THANKS button
ANd in your new postbit template

Add :

Code:


<phrase 1="$thank[nb]">$vbphrase[thanks_nb]</phrase>


teksigns 04-09-2004 10:19 PM

not sure im understanding where to put this :


Quote:

ANd in your new postbit template

Add :

Code:

<phrase 1="$thank[nb]">$vbphrase[thanks_nb]</phrase>


looking through the code ... does $nb var not already contain the count of thanks
because of line:

Code:

$nb=$DB_site->num_rows($thanks);

Boofo 04-09-2004 10:22 PM

The number of people who clicked the link doesn't show up for me. Just the phrase without the number. I even changed the phrase 1 to $thanks[nb] as it should be and the number still does not show up.

teksigns 04-09-2004 10:27 PM

Quote:

Originally Posted by Boofo
The number of people who clicked the link doesn't show up for me. Just the phrase without the number. I even changed the phrase 1 to $thanks[nb] as it should be and the number still does not show up.


from what i can see:

you shoudnt need to replace :

Code:

$thanks=$DB_site->query("SELECT * AS nb FROM ". TABLE_PREFIX ."thanks WHERE threadid='$thread[threadid]' ORDER BY username");

do the other steps though ....


and change the phrase line like this :


Code:

<phrase 1="$nb">$vbphrase[thanks_nb]</phrase>


All times are GMT. The time now is 04: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.02021 seconds
  • Memory Usage 1,900KB
  • 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
  • (13)bbcode_code_printable
  • (2)bbcode_html_printable
  • (4)bbcode_php_printable
  • (23)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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