Welcome, Guest. Please Login or Register.
May 06, 2025, 12:44:37 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Public Karma log? « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Public Karma log?  (Read 343 times)
finnhack
Noobie
*
Posts: 6


I'm a llama!

Public Karma log?
« on: October 02, 2002, 02:43:22 PM »
Reply with quote

Hi!

I'm looking for a way to make a public Karma-log, so that everyone can see who has given what kind of Karma to whom.

Can anyone kindly give me some ideas/codes how to fetch the right data from the database? I planned using the the data in log_karma-table, but due to my very poor PHP and MySQL skills I haven't managed to get all info together (for example putting the uid and real name together so that the log shows the users name instead of UID number)...

Thanks!
Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:Public Karma log?
« Reply #1 on: October 02, 2002, 03:13:19 PM »
Reply with quote

OK... so you have a query that gets the Karma info from the karma log table... now if you query the members table with ID_TARGET or ID_EXECUTOR and get the memberName you will have user name of who did it to whom.  You might be able to write all of that into 1 query of all the tables but I'm not the great with the MySQL yet either.

-Jack
Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
David
Destroyer Dave
Global Moderator
YaBB God
*****
Posts: 5761


I'm not a llama!

WWW
Re:Public Karma log?
« Reply #2 on: October 02, 2002, 05:29:28 PM »
Reply with quote

This mod could be tactfully evil but yet so friggen fun.
Logged

finnhack
Noobie
*
Posts: 6


I'm a llama!

Re:Public Karma log?
« Reply #3 on: October 03, 2002, 07:31:01 AM »
Reply with quote

Quote from: David on October 02, 2002, 05:29:28 PMThis mod could be tactfully evil but yet so friggen fun.
Might be I am an evil person  ;) But I really find this thing sort of important, and will probably try to work it out some how. So if I stay offline for the next two years, you know I'm working with the code.

edit:
$karma_result = mysql_query("SELECT * FROM {$db_prefix}log_karma ORDER BY logTime");
while($row_karmas = mysql_fetch_array($karma_result))
{
  echo "$row_karmas[ID_TARGET] $row_karmas[ID_EXECUTOR] $row_karmas[action]<br>\n";
}

Well, this simple code imports the Karmalog. My only problem is that I can't find out how to connect the ID_EXECUTOR and ID_TARGET to their respective real names in the members table...

« Last Edit: October 03, 2002, 08:07:20 AM by finnhack » Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:Public Karma log?
« Reply #4 on: October 03, 2002, 02:28:13 PM »
Reply with quote

$karma_result = mysql_query("SELECT * FROM {$db_prefix}log_karma ORDER BY logTime");
while($row_karmas = mysql_fetch_array($karma_result))
{
 $target_result = mysql_query("SELECT memberName FROM {$db_prefix}members WHERE ID_MEMBER=$row_karmas[ID_TARGET] LIMIT 1");
 $row_target = mysql_fetch_array($target_result)

 $executor_result = mysql_query("SELECT memberName FROM {$db_prefix}members WHERE ID_MEMBER=$row_karmas[ID_EXECUTOR] LIMIT 1");
 $row_executor = mysql_fetch_array($executor_result)

 echo "$row_target[memberName] $row_executor[memberName] $row_karmas[action]<br>\n";
}
 Maybe some SQL wiz can simplify this but I think it works.

-Jack

« Last Edit: October 03, 2002, 02:29:36 PM by Jack.R.Abbit » Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
finnhack
Noobie
*
Posts: 6


I'm a llama!

Re:Public Karma log?
« Reply #5 on: October 04, 2002, 10:25:13 AM »
Reply with quote

Thanks Jack! It works like a dream!

I changed the memberName to realName, and added two missing ";". The final, and for me working, code looks like this:


$karma_result = mysql_query("SELECT * FROM {$db_prefix}log_karma ORDER BY logTime DESC");
while($row_karmas = mysql_fetch_array($karma_result))
{
$target_result = mysql_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER=$row_karmas[ID_TARGET] LIMIT 1");
$row_target = mysql_fetch_array($target_result);

$executor_result = mysql_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER=$row_karmas[ID_EXECUTOR] LIMIT 1");
$row_executor = mysql_fetch_array($executor_result);
$ktime = timeformat( $row_karmas[logTime] );

print <<< EOT
 <tr onmouseover="javascript:style.backgroundColor='#eeeeee'" onmouseout="javascript:style.backgroundColor=''">
  <td style="padding : 2px; white-space : nowrap;">$ktime</td>
  <td style="padding : 2px; white-space : nowrap;">$row_executor[realName] gave $row_target[realName] a $row_karmas[action]</td>
 </tr>

EOT;

}
Logged
Jack.R.Abbit
Mod Team
YaBB God
*****
Posts: 553


RACE FOR SPENT!

Re:Public Karma log?
« Reply #6 on: October 04, 2002, 03:37:39 PM »
Reply with quote

Glad I could be of some use today.   ;D

-Jack
Logged

<--------  Mods by Jack  -------->
Package Server: http://www.modsbydesign.com/mods.by.jack/yabbse/ (now serving)


|----------------------------------------------|
|                                              |
|          DON'T PM ME FOR SUPPORT!             |
|                                              |
|----------------------------------------------|
PioneeR
Llama Hunter
YaBB God
*****
Posts: 767


Re:Public Karma log?
« Reply #7 on: October 05, 2002, 06:42:23 AM »
Reply with quote

Quote from: David on October 02, 2002, 05:29:28 PMThis mod could be tactfully evil but yet so friggen fun.

Sounds like a very good idea to enable when boards get a bit dull

How do I do it? Where do I put the code?  ;D
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Public Karma log? « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.040 seconds with 20 queries.