Add new category property to hide blog postings made into sub-categories from the frontend view, per category. Thanks to netmorix from the forums!
This commit is contained in:
@@ -1035,9 +1035,11 @@ function serendipity_addCategory($name, $desc, $authorid, $icon, $parentid) {
|
||||
* @param int The new category owner
|
||||
* @param string The new category icon
|
||||
* @param int The new category parent ID
|
||||
* @param int The new category sort order
|
||||
* @param int The new category subcat hiding
|
||||
* @return null
|
||||
*/
|
||||
function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $parentid) {
|
||||
function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $parentid, $sort_order = 0, $hide_sub = 0) {
|
||||
global $serendipity;
|
||||
|
||||
$query = "UPDATE {$serendipity['dbPrefix']}category
|
||||
@@ -1045,7 +1047,9 @@ function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $paren
|
||||
category_description = '". serendipity_db_escape_string($desc) ."',
|
||||
authorid = ". (int)$authorid .",
|
||||
category_icon = '". serendipity_db_escape_string($icon) ."',
|
||||
parentid = ". (int)$parentid ."
|
||||
parentid = ". (int)$parentid .",
|
||||
sort_order = ". (int)$sort_order . ",
|
||||
hide_sub = ". (int)$hide_sub . "
|
||||
WHERE categoryid = ". (int)$cid ."
|
||||
$admin_category";
|
||||
serendipity_db_query($query);
|
||||
@@ -1059,7 +1063,6 @@ function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $paren
|
||||
);
|
||||
|
||||
serendipity_updatePermalink($data, 'category');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -733,7 +733,7 @@ function serendipity_iframe_create($mode, &$entry) {
|
||||
|
||||
$_SESSION['save_entry'] = $entry;
|
||||
$_SESSION['save_entry_POST'] = $serendipity['POST'];
|
||||
|
||||
|
||||
$attr = '';
|
||||
switch($mode) {
|
||||
case 'save':
|
||||
|
||||
@@ -41,12 +41,17 @@ function serendipity_deleteCategory($category_range, $admin_category) {
|
||||
function serendipity_fetchCategoryRange($categoryid) {
|
||||
global $serendipity;
|
||||
|
||||
$res =& serendipity_db_query("SELECT category_left, category_right FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
|
||||
$res =& serendipity_db_query("SELECT category_left, category_right, hide_sub FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
|
||||
if (!is_array($res) || !isset($res[0]['category_left']) || !isset($res[0]['category_right'])) {
|
||||
$res = array(array('category_left' => 0, 'category_right' => 0));
|
||||
}
|
||||
|
||||
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_right']);
|
||||
if ($res[0]['hide_sub'] == 1) {
|
||||
// Set ranges only to own category. Patch by netmorix
|
||||
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_left']);
|
||||
} else {
|
||||
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_right']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +103,8 @@ function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
|
||||
c.category_name,
|
||||
c.category_description,
|
||||
c.category_icon,
|
||||
c.parentid
|
||||
c.parentid,
|
||||
c.hide_sub
|
||||
FROM {$serendipity['dbPrefix']}category AS c
|
||||
WHERE category_name = '" . serendipity_db_escape_string($categoryname) . "'";
|
||||
|
||||
@@ -111,7 +117,8 @@ function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
|
||||
c.category_name,
|
||||
c.category_description,
|
||||
c.category_icon,
|
||||
c.parentid
|
||||
c.parentid,
|
||||
c.hide_sub
|
||||
FROM {$serendipity['dbPrefix']}category AS c
|
||||
WHERE categoryid = " . (int)$categoryid;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user