hack for topitems block to work around permissions filtering
Curtis Farnham <curtisfarnham-v/2trG1LYpFWk0Htik3J/[email protected]> Thu, 29 Apr 2004 16:28:37 -0500
| Newsgroups | gmane.comp.cms.xaraya.knowledge-base |
|---|---|
| Message-ID | <[email protected]> |
If you are using the topitems block to show the X latest articles, and you
have some of those articles hidden from certain users (anonymous ones, in my
case), you may notice that the block only shows the latest X articles
*minus* the ones in that list that the user doesn't have permission to see.
The issue might not get a "real" fix for a while, so here is a hack: Replace
line 206 in modules/articles/xarblocks/topitems.php with:
'numitems' => $vars['numitems'] * 2
and insert the following new code starting at line 210:
for ($cnt = count($articles) - 1; $cnt >= $vars['numitems']; $cnt--) {
unset($articles[$cnt]);
}
This makes it select twice as many articles as are needed, and prunes the list
down to the number of items you really wanted. You will need to increase the
multiplier on line 206 if more than half of the latest articles are
restricted from certain users.
-Curtis