Forum Index   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
grumpfishOffline



Joined: May 08, 2004
Posts: 2

Status: Offline
Post   Posted: Nov 11, 2004 - 05:39 AM Reply with quote Back to top

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;

}

?>
View user's profile Send private message
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Nov 13, 2004 - 12:25 PM Reply with quote Back to top

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 ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Nov 13, 2004 - 12:31 PM Reply with quote Back to top

The file in Zip



pncUserPoints_pnForum_Plugin.zip
 Description:
pnForum plugin - pncUserPoints (1.5)

Download
 Filename:  pncUserPoints_pnForum_Plugin.zip
 Filesize:  2.46 KB
 Downloaded:  1229 Time(s)


_________________
Chestnut ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
grumpfishOffline



Joined: May 08, 2004
Posts: 2

Status: Offline
Post   Posted: Nov 14, 2004 - 11:44 PM Reply with quote Back to top

Chestnut wrote:
Hi Grump...
Why is line 51 commented... any special reason ?


uh... becuz I'm dumb. I forgot to unccomment it. Good catch.
View user's profile Send private message
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Nov 15, 2004 - 10:33 PM Reply with quote Back to top

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.


Laughing One of those days... Smile

_________________
Chestnut ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits
DarkMindZ