| Author |
Message |
grumpfish
Joined: May 08, 2004
Posts: 2
Status: Offline
|
  Posted:
Nov 11, 2004 - 05:39 AM |
|
I created a plugin for pnForum. Seems to work fine. This is the code for pnFourm.php.
| Code: | <?php
// File : $Id: pnForum.php,v 1.3 2004/11/01 15:42:54 fd Exp $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Chestnut !
// http://www.pnconcept.com
// Purpose of file: pnForum plugin for the pncUserPoints Mod !
// ----------------------------------------------------------------------
function pncUserPoints_userapi_pnForum($args)
{
extract($args);
if (!pnModAvailable('pnForum')) {
return $up;
}
pnModDBInfoLoad('pnForum');
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$bbtbl = $pntable['pnforum_posts'];
$ucolumn = &$pntable[ 'users_column' ];
if ($dateoveride == 1) {
if ($usestartdate == 1) {
# $datesql = "AND post_time > '".pnVarPrepForStore($startdate)."' ";
$datesql = "AND post_time > '0'";
} else {
$datesql = "";
}
} else {
if ($usestartdate == 1) {
$datesql = "AND post_time > '".pnVarPrepForStore($startdate)."' ";
} else {
$datesql = "AND post_time > '".pnVarPrepForStore($lastupdate)."' ";
}
}
$sql = "SELECT $ucolumn[uid],
$ucolumn[uname],
count(*) as ncount
FROM $bbtbl,
$pntable[users]
WHERE poster_id = $ucolumn[uid]
$sqlexclude
$datesql
GROUP BY poster_id
ORDER BY ncount DESC, post_time ASC";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() <> 0) {
$register_error = pnModAPIFunc('pncUserPoints',
'user',
'register_error',
array('plugin' => 'pnForum',
'error' => 'DB Error: '.$dbconn->ErrorNo().': '.$dbconn->ErrorMsg()));
return $up;
} else {
for( ; !$result->EOF; $result->MoveNext()) {
list($uid, $uname, $ncount) = $result->fields;
$points = $ncount * $value;
$up[$uname]['pnForum'] = $ncount;
$up[$uname]['uid'] = $uid;
$up[$uname]['TOTAL'] = $up[$uname]['TOTAL'] + $points;
}
}
$result->Close();
$unregister_error = pnModAPIFunc('pncUserPoints',
'user',
'unregister_error',
array('plugin' => 'pnForum'));
return $up;
}
?> |
|
|
|
|
|
 |
Chestnut
Site Admin
Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
|
  Posted:
Nov 13, 2004 - 12:25 PM |
|
Hi Grump...
I was about to make that a file to include in my cvs... but have a question...
Why is line 51 commented... any special reason ?
| Code: |
# $datesql = "AND post_time > '".pnVarPrepForStore($startdate)."' ";
|
|
_________________ Chestnut !
Administrator
PNConcept.com |
|
 |
 |
Chestnut
Site Admin
Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
|
  Posted:
Nov 13, 2004 - 12:31 PM |
|
The file in Zip |
| Description: |
| pnForum plugin - pncUserPoints (1.5) |
|
 Download |
| Filename: |
pncUserPoints_pnForum_Plugin.zip |
| Filesize: |
2.46 KB |
| Downloaded: |
1229 Time(s) |
_________________ Chestnut !
Administrator
PNConcept.com |
|
 |
 |
grumpfish
Joined: May 08, 2004
Posts: 2
Status: Offline
|
  Posted:
Nov 14, 2004 - 11:44 PM |
|
| Chestnut wrote: | Hi Grump...
Why is line 51 commented... any special reason ?
|
uh... becuz I'm dumb. I forgot to unccomment it. Good catch. |
|
|
|
|
 |
Chestnut
Site Admin
Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
|
  Posted:
Nov 15, 2004 - 10:33 PM |
|
| grumpfish wrote: | | Chestnut wrote: | Hi Grump...
Why is line 51 commented... any special reason ?
|
uh... becuz I'm dumb. I forgot to unccomment it. Good catch. |
One of those days...  |
_________________ Chestnut !
Administrator
PNConcept.com |
|
 |
 |
|
|
| |