Tracker: Bugs

5 Recent comments blocks shows all comments - ID: 1808484
Last Update: Settings changed ( dugris )

The recent comments block shows the comments of all the modules, even those
where you don't have access.

Modify the file /xoops/modules/system/blocks/system_blocks.php

In the function b_system_comments_show() just after this line :
$criteria->setOrder('DESC');

insert :

global $xoopsUser;
$moduleperm_handler =& xoops_gethandler('groupperm');

$gperm_groupid = is_object($xoopsUser) ? $xoopsUser->getGroups() :
XOOPS_GROUP_ANONYMOUS;
$criteria1 = new CriteriaCompo(new Criteria('gperm_name',
'module_read','='));
if (is_array($gperm_groupid)) {
$criteria2 = new CriteriaCompo();
foreach ($gperm_groupid as $gid) {
$criteria2->add(new Criteria('gperm_groupid', $gid), 'OR');
}
$criteria1->add($criteria2);
} else {
$criteria1->add(new Criteria('gperm_groupid', intval($gperm_groupid)));
}
$perms = $moduleperm_handler->getObjects($criteria1, true);
$modIds = array();
foreach($perms as $item) {
$modIds[] = $item->getVar('gperm_itemid');
}
if(count($modIds) > 0 ) {
$modIds = array_unique($modIds);
$criteria->add(new Criteria('com_modid', '('.implode(',', $modIds).')',
'IN'));
}

See this :
http://www.frxoops.org/modules/newbb/viewtopic.php?topic_id=21864&viewmode=
flat&order=ASC&start=0


InstantZero ( instantzero ) - 2007-10-06 07:31

5

Closed

Accepted

DuGris

Core - Core

XOOPS 2.0.x

Public


Comments ( 2 )

Date: 2007-10-24 00:13
Sender: dugris


// Check modules permissions
global $xoopsUser;
$moduleperm_handler =& xoops_gethandler('groupperm');
$gperm_groupid = is_object($xoopsUser) ? $xoopsUser->getGroups() :
array(XOOPS_GROUP_ANONYMOUS);
$criteria1 = new CriteriaCompo(new
Criteria('gperm_name','module_read','='));
$criteria1->add(new Criteria('gperm_groupid', '('.implode(',',
$gperm_groupid).')', 'IN'));
$perms = $moduleperm_handler->getObjects($criteria1, true);
$modIds = array();
foreach($perms as $item) {
$modIds[] = $item->getVar('gperm_itemid');
}
if(count($modIds) > 0 ) {
$modIds = array_unique($modIds);
$criteria->add(new Criteria('com_modid', '('.implode(',',
$modIds).')', 'IN'));
}
// Check modules permissions


fixed on xoops 2.0.18


Date: 2007-10-06 08:56
Sender: gibaphp


Thanks Hervé ;-)


Attached File

No Files Currently Attached

Changes ( 4 )

Field Old Value Date By
status_id Open 2007-11-02 10:07 dugris
close_date - 2007-11-02 10:07 dugris
resolution_id None 2007-10-24 00:13 dugris
assigned_to nobody 2007-10-24 00:13 dugris