Fullscreen
Loading...
 
Skip to main content

Inherit category from page from which new page is created

Status
Closed
Subject
Inherit category from page from which new page is created
Version
1.9.x
2.x
Category
  • Feature request
Feature
Wiki (page view, edit, history, rename, etc)
Submitted by
Nelson Ko
Volunteered to solve
Nelson Ko
Lastmod by
Nelson Ko
Rating
(0)
Description

When a user creates a new page from an existing page (either through the Create Page module or by clicking on a "?"), categories could be inherited.

The problem is that this is not necessarily behaviour required for all TIki installs, and might have to be coded as admin configurable.

Solution

One quick way that will not affect other Tiki code is just to add the following lines to tiki-editpage.php. The effect of this may or may not be what is required. Need comments if this is should be added to core.

Copy to clipboard
if ($feature_categories == 'y' && isset($_SERVER['HTTP_REFERER']) && (strstr($_SERVER['HTTP_REFERER'], 'tiki-index.php') ) { // default the categs the page you come from for a new page if (preg_match('/page=([^\&]+)/', $_SERVER['HTTP_REFERER'], $ms)) $p = urldecode($ms[1]); elseif (preg_match('/page_ref_id=([0-9]+)/', $_SERVER['HTTP_REFERER'], $ms)) { $pinfo = $structlib->s_get_page_info($ms[1]); $p = $pinfo["pageName"]; } else $p = $wikilib->get_default_wiki_page(); $cs = $categlib->get_object_categories('wiki page', $p); for ($i = count($categories) - 1; $i >= 0; --$i) { if (in_array($categories[$i]['categId'], $cs)) { $categories[$i]['incat'] = 'y'; $catpresetname = $categories[$i]['name']; $catpreset = true; $presettype = 'wiki page'; } } }
Importance
3
Priority
15
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
1086
Created
Wednesday 02 May, 2007 11:40:24 UTC
by Unknown
LastModif
Sunday 20 October, 2013 22:29:02 UTC


Show PHP error messages