This is a Draft
As of version 2.0.0, Geeklog now allows topics to have 1 or more child topics, blocks assigned to multiple topics, and articles assigned to multiple topics. Blocks and articles can also be inherited by the parent topic when viewed if it setup to do so. This is all done while still supporting multiple languages and a Archive Topic.
The different Topic modes (better word?) of Geeklog
Homepage All Topic (specific)
Now some objects can belong to more than one topic.
define("TOPIC_ALL_OPTION", 'all'); define("TOPIC_NONE_OPTION", 'none'); define("TOPIC_HOMEONLY_OPTION", 'homeonly'); define("TOPIC_SELECTED_OPTION", 'selectedtopics'); define("TOPIC_ROOT", 'root');
Tracking of Last Topic by Session DB Variable Anonymous users are now tracked like logged in users. The session changes include the ability to track anonymous users, and the who's online block now uses a column in the session table to track online versus offline users.
Topic Assignments table
Topics Inherited Hidden
- You are allowed only one. This is the same as before but at some point we may want to change this since it doesn't work well with a multi language Geeklog install (I would assume most admins would want an archive topic per language unless there was a reason this was not added?).
- Cannot be hidden
- Cannot have Child Topics
- Cannot be inherited
- Stories that are archived can only belong to this topic and no other
Getting/Setting the topic Figure out the current topic for a plugin and other parts of Geeklog (Comments, Search, ...). If permissions or language wrong it will find default else end with a topic (which is all). Needs to be run on page that is affected by the topic after lib-common.php is required so it can grab topic in url if need be. Also if pass blank $type and $id then return just last topic
TOPIC_getTopic($type = , $id = )
Blocks Blocks can now be inherited from child topics. Remember Blocks being inherited is affected by several things including security, the language of the block, the inherited flag set for that topic assignment for the block, and if the topics themselves allow objects to be inherited.
Topic Assignment Control I have also worked out a topic selection control that is used by blocks and will be used by stories and plugins. Here are the most common functions that most plugin author will use.
Show control in edit form by assigning the retval of this function to a template variable. TOPIC_getTopicSelectionControl($type, $id, $show_options = false, $show_inherit = false, $show_default = false)
Check topic control to see if any values are selected (for saves) TOPIC_checkTopicSelectionControl()
Check if User has access to the topics selected TOPIC_hasMultiTopicAccess('topic') == 3
There is the odd time that a plugin may need to know what topics have been selected when saving. This shouldn't happen to often but if need be you can find out by using the following function to retrieve Topic data. Before running this function you should validate the data with the above functions first. TOPIC_getDataTopicSelectionControl($topic_option, $tids, $inherit_tids, $default_tid);
Save the data in the topic control to the topic assignments table TOPIC_saveTopicSelectionControl('staticpages', $sp_id);
BreadCrumbs breadcrumbs are enabled for Topics, Articles and Staticpage plugin config options
- allowing a story to have multiple topics
- allowing stories to be inherited by parent topics
Admins are going to have to keep an eye on what topics are hidden and what security is set. If you remove read access for anonymous from the top topic then anonymous users will not have access to that topic only. They still would have access to child topics if their security allowed it (though these will not be displayed in the topics block since the path is broken). At some point we could add a checkbox to the Access Rights section to allow permissions to be set for child topics as well if checked and the topic was saved.
When viewing a topic, how does Geeklog decided when an article is inherited from multiple child topics which topic to associate to that specfic article in the specific topic? First off this association effects which topic icon is displayed as well as which topic is used if the visitor clicks on the article title or read more link. The topic icon that is associated with the article will be first the current topic (if that topic assignment exists). If it doesn't then it is the default topic if it exists in that topic tree branch. If not then the next topic used will be the based on the topic id in ascending order. Articles displayed on the front page do not need to worry about which topic is inherited so the default topic for that article will always be used.
The Topics block has been updated. It now shows the tree structure of the topics. Topics have several properties that affect them being displayed in this block. These are Security, if it is Hidden, and if it is a Topic for a different language. How it works is if the visitor doesn't have access to the child topic, or if it is hidden or in another language then it is not displayed. If it is not displayed then none of its child topics are displayed (even if the visitor would have access to the topic)