11
migoe
Re: Change recent comments block to show each article only once
  • 2008/4/29 22:20

  • migoe

  • Just popping in

  • Posts: 68

  • Since: 2003/4/2 9


hi trabis,

you are right thank you for your help now everything works perfect for me

migoe
whttp://www.liedermacher-forum.de | German Singers and Songwriters

http://www.weltladen-rothenburg.de | German Site about Fair trade Project

12
trabis
Re: Change recent comments block to show each article only once
  • 2008/4/29 23:22

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


I´m glad I could help!

13
blackrx
Re: Change recent comments block to show each article only once
  • 2008/7/26 3:15

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


perfect...this is what i want

Quote:

trabis wrote:
I see, try to replace the entire function with this one:

function b_system_comments_show($options)
{
    
$block = array();
    include_once 
XOOPS_ROOT_PATH.'/include/comment_constants.php';
    
$comment_handler =& xoops_gethandler('comment');
    
$criteria = new CriteriaCompo(new Criteria('com_status'XOOPS_COMMENT_ACTIVE));
    
$criteria->setLimit(intval($options[0] * 10));
    
$criteria->setSort('com_created');
    
$criteria->setOrder('DESC');
    
$comments $comment_handler->getObjects($criteriatrue);
    
$member_handler =& xoops_gethandler('member');
    
$module_handler =& xoops_gethandler('module');
    
$modules $module_handler->getObjects(new Criteria('hascomments'1), true);
    
$comment_config = array();

    
$trackedItems = array();
    
$count 0;
    foreach (
array_keys($comments) as $i) {
        if ( 
$count == $options[0])  continue;
        
$mid $comments[$i]->getVar('com_modid');
        
$com['module'] = '.XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/">'.$modules[$mid]->getVar('name').'';
        if (!isset(
$comment_config[$mid])) {
            
$comment_config[$mid] = $modules[$mid]->getInfo('comments');
        }
        
$com['id'] = $i;
        
$com['title'] = '.XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'.$comment_config[$mid]['pageName'].'?'.$comment_config[$mid]['itemName'].'='.$comments[$i]->getVar('com_itemid').'&com_id='.$i.'&com_rootid='.$comments[$i]->getVar('com_rootid').'&'.htmlspecialchars($comments[$i]->getVar('com_exparams')).'#comment'.$i.'">'.$comments[$i]->getVar('com_title').'';
        
$com['icon'] = htmlspecialchars$comments[$i]->getVar('com_icon'), ENT_QUOTES );
        
$com['icon'] = ($com['icon'] != '') ? $com['icon'] : 'icon1.gif';
        
$com['time'] = formatTimestamp($comments[$i]->getVar('com_created'),'m');
        if (
$comments[$i]->getVar('com_uid') > 0) {
            
$poster =& $member_handler->getUser($comments[$i]->getVar('com_uid'));
            if (
is_object($poster)) {
                
$com['poster'] = '.XOOPS_URL.'/userinfo.php?uid='.$comments[$i]->getVar('com_uid').'">'.$poster->getVar('uname').'';
            } else {
                
$com['poster'] = $GLOBALS['xoopsConfig']['anonymous'];
            }
        } else {
            
$com['poster'] = $GLOBALS['xoopsConfig']['anonymous'];
        }
        if (
count($trackedItems) > 0) {
            
$itemMatch false;
            foreach (
array_keys($trackedItems) as $j) {
                if (
$comments[$i]->getVar('com_modid') == $trackedItems[$j]['modid'] && $comments[$i]->getVar('com_itemid') == $trackedItems[$j]['itemid']) {
                    
$itemMatch true;
                }
            }
            if (!
$itemMatch) {
                
$block['comments'][] =& $com;
                
$trackedItems[] = array('modid' => $comments[$i]->getVar('com_modid'), 'itemid' => $comments[$i]->getVar('com_itemid') );
                
$count++;
            }
        } else {
            
$block['comments'][] =& $com;
            
$trackedItems[] = array('modid' => $comments[$i]->getVar('com_modid'), 'itemid' => $comments[$i]->getVar('com_itemid') );
            
$count++;
        }
        unset(
$com);
    }
    return 
$block;
}

Login

Who's Online

344 user(s) are online (215 user(s) are browsing Support Forums)


Members: 0


Guests: 344


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