With this mod you will be able apply category permissions including it's sub-categories.
----------- [ Installation ] ---------------
Step 1
Open admin/categories.php
Find: $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
Insert below:/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
$subcats = (isset($HTTP_POST_VARS['subcats']) && $HTTP_POST_VARS['subcats']) ? 1 : 0;
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
Step 1.1
Find: $msg = ($result) ? $lang['cat_edit_success'] : $lang['cat_edit_error'];
Insert above:
(for 4images v1.7/1.7.1 only!)
/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
if ($subcats)
{
function get_subcategories_id($cat_id = 0)
{
global $subcat_ids, $cat_parent_cache;
if (!isset($cat_parent_cache[$cat_id]))
{
return false;
}
foreach ($cat_parent_cache[$cat_id] as $key => $val)
{
$subcat_ids[] = $val;
get_subcategories_id($val);
}
return $subcat_ids;
}
$subcat_ids = array();
$subcat_ids = get_subcategories_id($cat_id);
if (!empty($subcat_ids))
{
$sql = "UPDATE ".CATEGORIES_TABLE."
SET auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
WHERE cat_id IN (".implode($subcat_ids, ",").")";
$result = $site_db->query($sql);
}
}
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
(for 4images v1.7.2 and newer)
/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
if ($subcats)
{
$subcat_ids = array();
$subcat_ids = get_subcategories_id($cat_id);
if (!empty($subcat_ids))
{
$sql = "UPDATE ".CATEGORIES_TABLE."
SET auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
WHERE cat_id IN (".implode($subcat_ids, ",").")";
$result = $site_db->query($sql);
}
}
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
Step 1.2
Find: show_form_footer($lang['save_changes'], $lang['reset'], 2, $lang['back']);
Insert above:
/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
show_radio_row("Apply to all subcategories", "subcats", $subcats);
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
That's all.
Now when you edit category permissions, you should see a new option Apply to all subcategories