1
metin
want to understand xoopscomment system ?
  • 2005/9/30 15:07

  • metin

  • Just popping in

  • Posts: 64

  • Since: 2003/6/21


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 ?

2
Mithrandir
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

3
metin
Re: want to understand xoopscomment system ?
  • 2005/9/30 15:20

  • metin

  • Just popping in

  • Posts: 64

  • Since: 2003/6/21


we are using 2.0.13 ( http://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.

4
Mithrandir
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

5
metin
Re: want to understand xoopscomment system ?
  • 2005/9/30 17:33

  • metin

  • Just popping in

  • Posts: 64

  • Since: 2003/6/21


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.

6
metin
Re: want to understand xoopscomment system ?
  • 2005/10/17 18:18

  • metin

  • Just popping in

  • Posts: 64

  • Since: 2003/6/21


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;
}

Login

Who's Online

321 user(s) are online (243 user(s) are browsing Support Forums)


Members: 0


Guests: 321


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits