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)

VBDev 04-02-2004 10:00 PM

Automatic 'Thank you' Hack
 
Total hack's description : http://www.vbulletindev.net/forums/h...hack&hackid=49

Site : http://www.vbulletindev.net/forums


You can set in wanted forums with this hack, an option which displays in a special post of a thread, the list of members who clicked the 'Thank you' button. So, instead of having a lot of posts saying : 'Great', 'Big thx :D' ... you only have one post.

The postbit (legacy or not) automatically adapts itself too.

The phrase to thank the thread creator change if there is one user or more which clicks the button, so the verb is always correct
There is an other option too in Forum manager, to set if you want to see at which date the 'Thank you' button was clicked by the member.

Hack requested by boofo


Eventual bugs :Correct with it

Giveit2u43 04-02-2004 11:12 PM

[high]* Giveit2u43 clicks "Thank You" Button ;)[/high]

Fi_InCogNiTo 04-02-2004 11:46 PM

How do you delete a thanks post? There's no edit button on its post and also doesnt show when you click delete posts in thread tools =|

Fi_InCogNiTo 04-02-2004 11:52 PM

Also, does et ajoutez en dessous mean add after?

dirtymerc 04-03-2004 12:17 AM

im hving problems with it repeating the thanks (username) twice in the thanks bot post.

Fi_InCogNiTo 04-03-2004 01:02 AM

I had the same problem. I just deleted the second phrase in the new postbit.

calvinnguyen 04-03-2004 01:20 AM

I had a problem when I click on the botton I got this message:
Any ideas about this error? And How I can fixed it? MAny thanks

CALVIn, 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.

========================

Also I don't understand this intruction:

Don't forget to add a prefix to table's name if you use one in your config.php :

What's exactly I have to do inside my config.php

gmarik 04-03-2004 06:17 AM

interesting one
/me asks: what will come next?

draculanowaday 04-03-2004 07:29 AM

/me installed

Boofo 04-03-2004 08:17 AM

Hey, buddy, looks good. ;)

Can you make a button that says Thank you! instead of Thanks it! ? ;)

VBDev 04-03-2004 08:53 AM

@dirtymerc vbmenu_register("postmenu_494851", true); : For the phrase repeated twice, it's the problem I had with conditional in templates, but when I fix it in PHP files, it seems to work, I look at it

Yes, ajoutes en dessous, mean add under

An edit button, no and I don't will do it, you don't choose if a user thanks or not ;)

I look for other problems too

Boofo 04-03-2004 09:31 AM

How about the button that says Thank you! ?

VBDev 04-03-2004 09:31 AM

To remove the sentence repeated twice, replace the thanks_postbit with :

PHP Code:

 $spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">
<
table class="tborder" id="post$post[postid]cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%" align="center">
<
tr>
<
td class="thead" $scrolltothis>
<
div class="normal" style="float:$stylevar[right]">
&
nbsp;
</
div>
 
<
div class="normal">
<!-- 
status icon and date -->
<
a name="post$post[postid]"><img class="inlineimg" src="$stylevar[imgdir_statusicon]/post_old.gif" alt="$post[statustitle]border="0" /></a>
 
    
$post[postdate], $post[posttime]</if>
     
$post[firstnewinsert]
<!-- / 
status icon and date -->
</
div>
</
td>
</
tr>
<
tr>
<
td class="alt2" style="padding:0px">
<!-- 
user info -->
<
table cellpadding="0" cellspacing="$stylevar[cellpadding]border="0" width="100%">
<
tr>
<
td nowrap="nowrap">
 
    <
div id="postmenu_$post[postid]">
     
$username     </div>     
</
td>
<
td width="100%">&nbsp;</td>
<
td valign="top" nowrap="nowrap"
<
font class="smallfont"><div>$vbphrase[location_perm]: $vboptions[bbtitle]</font></div>
</
td>
</
tr>
</
table>
<!-- / 
user info -->
</
td>
</
tr>
<
tr>
<
td class="alt1">
<!-- 
messageattachmentssig --> 
<!-- 
icon and title -->
<
div class="smallfont">
    <
img class="inlineimg" src="images/icons/icon1.gif" alt="Post" border="0" />
<
strong>$vbphrase[thanks_title]</strong>
</
div>
<
hr size="1" style="color:$stylevar[tborder_bgcolor]/>
<!-- / 
icon and title -->
 
<!-- 
message -->
<
div>$liste_user $thank_phrase
<br /><br /></div>
<!-- / 
message --> 
</
td>
</
tr>
</
table>
</
div>
$spacer_close
<!-- / post #$post[postid] --> 


And the thanks_postbit_legacy with :

PHP Code:

 $spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">
<
table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="0" border="0" width="100%" align="center">
<
tr>
<
td class="thead" style="font-weight:normal" $scrolltothis
<!-- 
status icon and date -->
<
a name="post$post[postid]"><img class="inlineimg" src="$stylevar[imgdir_statusicon]/post_old.gif" alt="$post[statustitle]border="0" /></a>
    
$post[postdate], $post[posttime]</if>
$post[firstnewinsert]
<!-- / 
status icon and date -->    
</
td>
<
td class="thead" style="font-weight:normal" align="$stylevar[right]">
&
nbsp;
</
td>
</
tr>
<
tr valign="top">
<
td class="alt2" width="175">
 
$username 
<div class="smallfont">
    &
nbsp;<br />
    <
div>$vbphrase[location_perm]: $vboptions[bbtitle]</div>                                </div>     
 
</
td>
<
td class="alt1">
<!-- 
icon and title -->
<
div class="smallfont">
    <
img class="inlineimg" src="$post[iconpath]alt="images/icons/icon1.gif" border="0" />
    <
strong>$vbphrase[thanks_title]</strong>
</
div>
<
hr size="1" style="color:$stylevar[tborder_bgcolor]/>
<!-- / 
icon and title --> 
<!-- 
message -->
<
div>$liste_user $thank_phrase
 
<br /><br /></div>
 
</
td>
</
tr>
<
tr>
<
td class="alt2">
&
nbsp;
</
td>
<
td class="alt1" align="$stylevar[right]">
&
nbsp;
</
td>
</
tr>
</
table>
$spacer_close
<!-- / post #$post[postid] --> 

I had corrected it in the legacy but forgot the other one ;)

@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

Edit boofo : I do your button now ;)

Martyjp 04-03-2004 09:34 AM

I saw this on an ipb the other day and thought how useful it would be to have on this site

VBDev 04-03-2004 09:38 AM

Zip updated

Boofo, the new button is in the zip ;)

Boofo 04-03-2004 09:39 AM

I forgot to ask, sorry. If a user clicks the button more than once on other visitis to the site, it won't add their name again will it? It should only show the first time they click it. Does it already do this?

VBDev 04-03-2004 09:42 AM

Yes boofo it already does this

If a user clicked twice (or more) the button, after the first time, he will get an error message saying he has already thanked for this thread.

Unregistered members can not thank too

Boofo 04-03-2004 09:45 AM

Thank you very much. Wouldn't it be easier if the thank you button didn't show up for unergistered users, also?

VBDev 04-03-2004 09:47 AM

If you want ;)

Just add a conditional in the showthread template on this button so

PHP Code:

<if condition="$bbuserinfo[userid]!=0">...button ...</if> 


Boofo 04-03-2004 09:50 AM

LOL I was going to do that but I didn't know if you wanted to updated the install file with it, too. Excellent job, my friend. Clciking install and installing. ;)

Boofo 04-03-2004 10:31 AM

How do we set the thank you button to only show up on the forums it is turned on for? Right now, it shows up on all forums. ;)

VBDev 04-03-2004 11:07 AM

In the showthread template :

Replace
Code:

<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>

with

Code:

<if condition="$forum[showthanks]==1"><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></if>


Boofo 04-03-2004 11:30 AM

Yeah, I just figured that out before coming up here to tell you. ;)

Only, this is what I used and it seems to work fine.

HTML Code:

<if condition="$forum['showthanks']">

Boofo 04-03-2004 11:33 AM

Is there a way to add this:

Quote:

thanks username for this thread
as the title of the message instead of actually being in the message?

VitroX 04-03-2004 11:50 AM

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!

VBDev 04-03-2004 01:00 PM

I don't want to work on vBulletin now ;)

But I'll look for these 2 things (title for boofo, really not hard, and for you counter vitrox, not harder )

Boofo 04-03-2004 01:01 PM

When you are ready to work on vBulletin again, I have a couple things to talk to you about. PM me when you are aready. ;)

VBDev 04-03-2004 01:03 PM

I'll have a really hard night this evening, and will not be able to work tomorrow, I think I'll stay at bed all the day ! :p

Monday, I look for this ;)

Boofo 04-03-2004 01:04 PM

PM me Monday and we'll talk then. Hope you feel better. ;)

Mone' 04-03-2004 04:08 PM

Hi thank you for the hack everything works great so far :)

I'd like to point a few things........


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?

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


3 admin should be able to delete thank you post

4 like other have requested I would like to see a counter of the totla user that said thank you :)

Apart of that great job!

Mone'

calvinnguyen 04-03-2004 05:13 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 saw the line below at config.php
$tableprefix = ' ';


Do I add this line in like as below: BUT WHEN I RUN IT STILL GIVE ME ERROR. I am really don't know how to run sql

Error

SQL-query :

$tableprefix = ' '

MySQL said:


#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '$tableprefix = ' '' at line 3


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

ALTER TABLE `forum` ADD `showthanks_date` INT(1) DEFAULT '0' NOT NULL;
$tableprefix = '';
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
);

VitroX 04-03-2004 08:05 PM

Quote:

Originally Posted by VBDev
I'll have a really hard night this evening, and will not be able to work tomorrow, I think I'll stay at bed all the day ! :p

Monday, I look for this ;)

no problem, take your time and enjoy the weekend ;)

calvinnguyen 04-03-2004 08:59 PM

Quote:

Originally Posted by calvinnguyen
I saw the line below at config.php
$tableprefix = ' ';


Do I add this line in like as below: BUT WHEN I RUN IT STILL GIVE ME ERROR. I am really don't know how to run sql

Error

SQL-query :

$tableprefix = ' '

MySQL said:


#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '$tableprefix = ' '' at line 3


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

ALTER TABLE `forum` ADD `showthanks_date` INT(1) DEFAULT '0' NOT NULL;
$tableprefix = '';
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
);

Anyone can help me with this problem above. Many thanks

Boofo 04-03-2004 09:03 PM

Just run the query as it is and you will be allright.

calvinnguyen 04-03-2004 09:24 PM

Quote:

Originally Posted by Boofo
Just run the query as it is and you will be allright.

when I run this: code below I got this error: How can I clear up this error.

Error

SQL-query :

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

MySQL said:


#1060 - Duplicate column name 'showthanks'



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
);

calvinnguyen 04-03-2004 09:42 PM

I run success for SQL queries on my database, but I don't understand for this line:

Don't forget to add a prefix to table's name if you use one in your config.php

Look in config.php
I see this:
$tableprefix = '';

What do I need to do?
because right now when I click on the " thank you" button to test. It give me this message:

Calvin, 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.

Boofo 04-03-2004 09:52 PM

Just run these 3 queries and don't worry about the table_prefix. You don't have one. ;)

Quote:

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
);

calvinnguyen 04-03-2004 10:43 PM

I have already run it. And following all intruction that he gave. But when I test to click on a button "Thank you" , It said I did't have permision like that message previous posts.

tnguy3n 04-04-2004 01:27 AM

Quote:

Originally Posted by calvinnguyen
I have already run it. And following all intruction that he gave. But when I test to click on a button "Thank you" , It said I did't have permision like that message previous posts.

Enable "thank you button" when you create new forums or update existing forums in Forum Permision.


Quote:

In postbit and postbit_legacy templates, add at the end :

------------------------------------------------------------------------
$thanks_post
------------------------------------------------------------------------
Wouldn't it better to add $thanks_post in postbit instead? :rolleyes:

VBDev 04-04-2004 06:32 PM

Quote:

Originally Posted by tnguy3n
Wouldn't it better to add $thanks_post in postbit instead? :rolleyes:

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


All times are GMT. The time now is 05:03 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.01368 seconds
  • Memory Usage 1,886KB
  • 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
  • (1)bbcode_html_printable
  • (3)bbcode_php_printable
  • (9)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