for Mkportal M1.1 Rc1
by visiblesoul
This hack will allow you to include or exclude individual gallery categories from the random image block. Set the categories to include or exclude in the $catlist variable in the config section of the block.
To include certain categories:
FIND in /mkportal/blocks/random_pic.php:
$content = "";
$count = $this->stats['tot_gallery'];
$start = rand(0, ($count -1));
$query = $DB->query("SELECT id, titolo, file FROM mkp_gallery where validate = '1' LIMIT $start, 1");
REPLACE WITH:/*-------------------------------------------------------------------------
Config:
--------------------------------------------------------------------------*/
$catlist = "1,2,3,4,5"; // List gallery category IDs to get images from. Separate IDs with commas
/*------------------------------------------------------------------------*/
$content = "";
$catquery = $DB->query("SELECT id FROM mkp_gallery WHERE evento IN ($catlist)");
$count = $DB->get_num_rows ($catquery);
$start = rand(0, ($count -1));
$query = $DB->query("SELECT id, titolo, file, evento FROM mkp_gallery WHERE validate = '1' AND evento IN ($catlist) LIMIT $start, 1");
FIND:unset($thumb);ADD BELOW:
unset($catlist); unset($catquery);------------------------------------------
To exclude certain categories:
FIND in /mkportal/blocks/random_pic.php:
$content = "";
$count = $this->stats['tot_gallery'];
$start = rand(0, ($count -1));
$query = $DB->query("SELECT id, titolo, file FROM mkp_gallery where validate = '1' LIMIT $start, 1");
REPLACE WITH:/*-------------------------------------------------------------------------
Config:
--------------------------------------------------------------------------*/
$catlist = "1,2,3,4,5"; // List gallery category IDs to get images from. Separate IDs with commas
/*------------------------------------------------------------------------*/
$content = "";
$catquery = $DB->query("SELECT id FROM mkp_gallery WHERE evento NOT IN ($catlist)");
$count = $DB->get_num_rows ($catquery);
$start = rand(0, ($count -1));
$query = $DB->query("SELECT id, titolo, file, evento FROM mkp_gallery WHERE validate = '1' AND evento NOT IN ($catlist) LIMIT $start, 1");
FIND:unset($thumb);ADD BELOW:
unset($catlist); unset($catquery);













