xoops forums

metin

Just popping in
Posted on: 2005/9/30 15:07
metin
metin (Show more)
Just popping in
Posts: 64
Since: 2003/6/21
#1

want to understand xoopscomment system ?

my intention is to count only comments from one modul ( pd-downloads ) in userposts but don´t understand xoopscomment system really.

How does it work ? and is it possible to count only comments from one module ?

Mithrandir

XOOPS is my life!
Posted on: 2005/9/30 15:11
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#2

Re: want to understand xoopscomment system ?

$module_handler xoops_gethandler("module");
$pd_module $module_handler->getByDirname("PDdownloads");
$comment_handler xoops_gethandler("comment");

$criteria = new Criteria("com_modid"$pd_module->getVar('mid'));
$criteria->setGroupBy("com_uid");
$counts_per_user $comment_handler->getCount($criteria);


At least for XOOPS 2.2.x, this should work and give you an array of
uid => number of comments in PD downloads module
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

metin

Just popping in
Posted on: 2005/9/30 15:20
metin
metin (Show more)
Just popping in
Posts: 64
Since: 2003/6/21
#3

Re: want to understand xoopscomment system ?

we are using 2.0.13 ( www.remixland.de )

thank you very much.

but i don´t now where i have to use this code.

& how have to be the code in userpoints ( when i don´t change xoopscomment system counting ) ? This module is counting all comments.

i think the changes there have to be in funcs.php but im not sure.

Mithrandir

XOOPS is my life!
Posted on: 2005/9/30 16:01
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#4

Re: want to understand xoopscomment system ?

funcs.php
[d]function tabComments($uids) {
    global 
$xoopsDB$periodej;
    list(
$comb) = $xoopsDB->fetchRow($xoopsDB->query("SELECT  COUNT(*)  FROM ".$xoopsDB->prefix("xoopscomments")." WHERE com_uid='$uids' AND com_created > '$periodej'"));
    
$abacus $comb;
    return 
$abacus;
}[/
d]
function 
tabComments($uids) {
    global 
$xoopsDB$periodej;
        
$module_handler xoops_gethandler("module");
        
$pdmodule $module_handler->getByDirname("PDdownloads");
        
$sql "SELECT  COUNT(*)  FROM ".$xoopsDB->prefix("xoopscomments")." WHERE com_uid='$uids' AND com_created > '$periodej'";
        if (
is_object($pdmodule)) {
            
$sql .= " AND com_modid=".$pdmodule->getVar('mid');
        }
    list(
$comb) = $xoopsDB->fetchRow($xoopsDB->query($sql));
    
$abacus $comb;
    return 
$abacus;
}
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

metin

Just popping in
Posted on: 2005/9/30 17:33
metin
metin (Show more)
Just popping in
Posts: 64
Since: 2003/6/21
#5

Re: want to understand xoopscomment system ?

mithandir i thank you very very much.

did change the code and it works.

i will add at next the group & rank where the user is to the list but think that should not be a great problem. Another idea is to subtract points if an user downloads an track. ok i am working on that.

You did help me a lot thanks again.

metin

Just popping in
Posted on: 2005/10/17 18:18
metin
metin (Show more)
Just popping in
Posts: 64
Since: 2003/6/21
#6

Re: want to understand xoopscomment system ?

your code is working but i have a great problem with unactive comments. No matter if I am deleting them or not all comments in pddownloads are counting.

I add at line 69 ( com_status = 2 ) to get the active comments only but my code isn´t working.

Who can help me ?

function tabComments($uids) {
    global 
$xoopsDB$periodej;
        
$module_handler xoops_gethandler("module");
        
$pdmodule $module_handler->getByDirname("PDdownloads");
        
$sql "SELECT  COUNT(*)  FROM ".$xoopsDB->prefix("xoopscomments")." WHERE com_uid='$uids' AND com_created > '$periodej' AND com_status = '2'"
        if (
is_object($pdmodule)) {
            
$sql .= " AND com_modid=".$pdmodule->getVar('mid');
        }
    list(
$comb) = $xoopsDB->fetchRow($xoopsDB->query($sql));
    
$abacus $comb;
    return 
$abacus;
}