PDA

View Full Version : Public Display of Affection (reputation display)


vbmechanic
02-18-2004, 10:00 PM
Allow your users to easily "agree" or "disagree" with a post-- rather than having them make a whole new post, you can simply use the existing reputation system.. which is meant for exactly this purpose.

Purpose: This hack makes each post's reputation visible to everyone. You can turn this on and off per forum.

Modifications: 2 additions to admincp/forum.php, 2 template additions, 1 query

Install Time: 10 minutes

Difficulty: Easy

Screenshot attached of a post with reputation comments!


cheers,

vBMechanic




EDIT: changed functions_showthread.php edit, file changed 5:49PM PST

The Quibbler
02-19-2004, 02:55 AM
/me will install very soon

robertuss
02-19-2004, 06:39 AM
I love you :)

vbmechanic
02-19-2004, 03:48 PM
I must admit, I love you too!

*group hugs*

Martin CX
02-19-2004, 05:34 PM
Love is all around us... but before I install... is there anyway of moderating these public display of affections? :) I wouldn't want to create a way for people to be circumvent my moderators.

Allan
02-19-2004, 05:48 PM
very nice, i take, thank :)

vbmechanic
02-19-2004, 06:42 PM
Good point-- it does not have any moderation capability and it does not take into consideration the user's ignore list. It is quite basic! Maybe I will add these features to an upgrade.

gmarik
02-22-2004, 06:15 AM
nice idea, still it could be 5 stars, not more, the rating maximum

robertuss
03-02-2004, 05:02 AM
Good point-- it does not have any moderation capability and it does not take into consideration the user's ignore list. It is quite basic! Maybe I will add these features to an upgrade.
...mh , or should we ask around if any other coder wants to try his/her luck?

Geographic2
03-22-2004, 06:36 AM
If one of your users has a problem using the system you can simply take away reputation priveledges I guess. ;)

red_baron2000
04-13-2004, 01:33 AM
cool hack ..i install thank you :)

Brahm
05-09-2004, 03:00 AM
nice

Nj?rd Eriksson
05-09-2004, 07:38 PM
I installed this hack and it works great.

However, most of my members seem to prefer to have the reputation comments not publicly.

Question:

If I want to uninstall it, how would I reverse this my SQL query?

ALTER TABLE `forum` ADD `showaffection` SMALLINT(6) UNSIGNED DEFAULT "0" NOT NULL

Majik?
05-10-2004, 01:08 AM
how would I reverse this my SQL query?

ALTER TABLE `forum` ADD `showaffection` SMALLINT(6) UNSIGNED DEFAULT "0" NOT NULLALTER TABLE `forum` DROP `showaffection`;

Nj?rd Eriksson
05-11-2004, 01:36 AM
ALTER TABLE `forum` DROP `showaffection`;
Thank you. Worked like a gem. :)

Reeve of shinra
06-04-2004, 06:02 PM
Rather than the comments, I just want a little thumbs up or down if they gave positive rep or not -- is there a way to do that with this hack?

TJFweb
06-29-2004, 03:26 AM
Well, this hack doesn't work under 3.0.1... I don't think.

I installed it twice and I can't get anything to show under the posts yet it doesn't throw any errors.

yinyang
06-29-2004, 08:34 PM
Well, this hack doesn't work under 3.0.1... I don't think.

I installed it twice and I can't get anything to show under the posts yet it doesn't throw any errors.
me 2. i'm having the same problem. weird. anyone have any thoughts?

yinyang
06-29-2004, 08:50 PM
me 2. i'm having the same problem. weird. anyone have any thoughts?
TJFweb, i bet it's because you and i are using Postbit Legacy. am i right? now before i go tearing into it trying to code... 'cause i have no idea what i'm doing, can anyone plese suggest the proper way to do it?

TJFweb
06-30-2004, 12:09 AM
TJFweb, i bet it's because you and i are using Postbit Legacy. am i right? now before i go tearing into it trying to code... 'cause i have no idea what i'm doing, can anyone plese suggest the proper way to do it?
That's right, I am using postbit_legacy... ???

vbmechanic
07-03-2004, 01:09 PM
OK I looked over the install routine and I didn't see anything that would prevent it from working in 3.0.1 or 3.0.2; nothing much has changed.

If you're using postbit_legacy, did you make that change during the install?

"Alter template 'postbit', BELOW:"

Did you take that line in the instructions and instead alter postbit_legacy ?

Sanity
07-05-2004, 12:01 PM
Hello,

installed everything as explained, but I get this error-message when I try to read a thread:


Datenbankfehler in vBulletin 3.0.2:

Ungueltige SQL-Abfrage: SELECT reputation.reputation,reputation.whoadded,reputati on.reason,user.username
FROM vb_reputation
LEFT JOIN vb_user ON reputation.whoadded=user.userid
WHERE reputation.reputation!=0 AND postid='22'
mysql error: Unknown table 'reputation' in field list

mysql error number: 1109


Iam using a tableprefix.

Any suggestions?

Sanity
07-05-2004, 12:36 PM
Figured out the problem. Prefixes missing o_O

Sanity
07-05-2004, 01:01 PM
*install*

Reeve of shinra
07-16-2004, 02:16 AM
Finally got around to installing this. This is exactly what I wanted.

I added this to the postbit_fuction template to show the rep only to the perosn that made the post. A compromise between those who wanted it and those who didnt.


<if condition="$bbuserinfo['userid'] == $post['userid']">

dndog
12-05-2004, 02:41 AM
Hello,

installed everything as explained, but I get this error-message when I try to read a thread:



Iam using a tableprefix.

Any suggestions?

I'm having this same problem and I'm using a table prefix also.

What'd you do to fix this? :nervous:

robertuss
12-09-2004, 02:39 PM
erm, what's with the moderateablities?

dndog
12-17-2004, 03:10 AM
Not meaning to seem impatient, but its been 12 days. Can someone help me?

nintendo
02-01-2005, 12:31 AM
Is there an SQL Query that can be used to turn it on on all boards?

Jamsoft
02-15-2005, 05:44 PM
Hey guys,

I installed this on our forums, and wouldnt you know that our users found a vulnerability almost right away.

Seems that if the users put any HTML or JAVA code inside the comments, it actually renders when the page loads. For example:


Rich agrees: Sounds good <script>alert('hi');</script>


Makes a java window pop open and say hi...

Im sure I dont have to tell you what a malicious hacker can do with something like this.

So, I'd propose this fix to the existing code. Inside the functions_showthread.php, find this code:


// START PUBLIC DISPLAY OF AFFECTION hack
if ($forum['showaffection'])
{
$post['affection']="";
$repcount=0;
if ($reps = $DB_site->query("SELECT reputation.reputation,reputation.whoadded,reputati on.reason,user.username
FROM " . TABLE_PREFIX . "reputation
LEFT JOIN " . TABLE_PREFIX . "user ON reputation.whoadded=user.userid
WHERE reputation.reputation!=0 AND postid='".$post['postid']."'"))
{
while ($rep = $DB_site->fetch_array($reps))
{
eval('$post[\'affectionbits\'] .= "' . fetch_template('postbit_affectionbit') . '";');
$repcount++;
}
if ($repcount)
{
//echo "2";
eval('$post[\'affection\'] .= "' . fetch_template('postbit_affection') . '";');
}
else
{
//echo "3";
$post['affection']="";
}
}
}
// END PUBLIC DISPLAY OF AFFECTION hack


BEFORE the line:

eval('$post[\'affectionbits\'] .= "' . fetch_template('postbit_affectionbit') . '";');


Add this code:

// Fix for HTML entities
$rep[reason] = htmlentities($rep[reason]);


That will protect us from this issue.

Other than that, this is a great hack. Im using it on 3.0.6 on 5 forums...

Borgs8472
02-26-2005, 01:10 PM
^ ^
thanks a lot! :D

IceFanatic
03-04-2005, 09:16 PM
Would there be any way to alter this hack so that users can turn it on or off for their posts/comments? So if one user doesn't want their rep (given or received) shown publically they can turn it off. Any way to do that easily? Or would that be too difficult...

subnet_rx
03-31-2005, 02:40 AM
this is a great hack, I'd love to see it updated with some of the features listed here.

nintendo
05-04-2005, 03:49 AM
With this hack, members can now post HTML in the reputation. Great way to generate abuse.

Citizen E
06-08-2005, 03:04 PM
Has anyone gotten this mod to work for 3.0.7?

johnn
07-09-2005, 02:35 AM
Datenbankfehler in vBulletin 3.0.2:

Ungueltige SQL-Abfrage: SELECT reputation.reputation,reputation.whoadded,reputati on.reason,user.username
FROM vb_reputation
LEFT JOIN vb_user ON reputation.whoadded=user.userid
WHERE reputation.reputation!=0 AND postid='22'
mysql error: Unknown table 'reputation' in field list

mysql error number: 1109

I'm getting pretty much the same problem. Could someone be so kind as to please tell me how to fix this?

johnn
07-10-2005, 06:18 AM
Nevermind. I figured it out on my own, but I figured I'd go ahead and post the solution here as some other person had the same problem and no one answered them.

if ($reps = $DB_site->query("SELECT reputation.reputation,reputation.whoadded,reputati on.reason,user.username
FROM " . vb3_ . "reputation AS reputation
LEFT JOIN " . vb3_ . "user AS user ON reputation.whoadded=user.userid
WHERE reputation.reputation!=0 AND postid='".$post['postid']."'"))

Use that, and where it has the 2 instances of "vb3_" put your own table prefix there, if you have one (which you likely do). You can find what your table prefix is, if you don't know it, in your "includes/config.php" file.

That should work.

Citizen E
08-10-2005, 07:39 PM
Anyone get this to work with 3.0.8?

Noodles24
09-07-2005, 11:13 PM
Anyone get this to work with 3.0.8?

Yup, if you're using the legacy display, you need to add the
<div>$post[affection]</div> in the legacy postbit too (took me a while to find)

Jedi Blaze
10-01-2005, 08:40 PM
Will this work with 3.5 or does it need code changes.

Citizen E
10-13-2005, 12:56 AM
I'd say this would work with 3.5 but I was really hoping to see a plugin or product made of it.

robertuss
11-01-2005, 01:41 PM
is the html/javascript issue resolved?

Jedi Blaze
11-08-2005, 09:02 PM
So any news on porting it?

kafi
11-10-2005, 08:03 PM
So any news on porting it?

Is there a way to show given points along with comments?

Thank you!


P.S.:I would love to see this for 3.5

Borgs8472
11-11-2005, 02:46 PM
is the html/javascript issue resolved?
in this very post

Zachariah
11-12-2005, 04:18 PM
porting, yes.

zylstra
12-29-2005, 07:35 PM
I'd love to see a port to 3.5 also.
porting, yes.Does this mean you're in the process of porting it? Thanks.

Here it is: https://vborg.vbsupport.ru/showthread.php?t=103046&highlight=reputation.