EllisLab text mark
Advanced Search
     
Extension: Retroactive Parents
Posted: 04 December 2009 08:05 AM
Avatar
Joined: 2007-02-02
982 posts

The attached add-on files may be out of date.  Please visit Devot-ee for the latest versions.

This extension enables to make selected parent categories retroactive.

Let me explain the concept.

In one case exp_category_posts table is not updated when one would expect it to be updated. Say you have a category which has category id 260. Then you post into that category an entry, which has entry id 3377. Then if you run the code

{exp:query sql="SELECT cat_id FROM exp_category_posts WHERE entry_id = '3377'"}
{cat_id}
{
/exp:query} 

the category id of the entry will be displayed.

Now say you create a category which has category id 261 and after that you make this category the parent of the category 260.

Having made such changes you would expect that the code above will display both category ids - 260 and 261. But instead it will display only 260 as earlier.

Both category ids will be displayed only in case the entry 3377 will be updated after category 261 was made the parent of the category 260.

I think that such behavior is not good since it goes against the principle that all entries posted into child category are considered to be entries posted into its parent category. I even thought that this behavior might be considered a bug, but Robin disagreed

Bug or not, it seems that after some category was made a parent of some other category, the table exp_category_posts should be updated accordingly to reflect the change.

As it is, when you make this kind of category relationship change the change doesn’t “take” in individual entries unless you go through and update every single one.

Now using Retroactive Parents extension you have a means to make your changes retroactive if you choose, that is this extension will make what is needed that for selected parent categories all entries posted into any child category will also be posted into relevant parent category.

Notice: in cases nesting of categories is more than one level deep you may need to submit the form ordering to make parent categories retroactive several times untill all needed categories will be made retroactive. This is so because on each submission only those entries which currently are posted into subcategory but not into their immediate parent category are posted into their immediate parent category.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

 
Posted: 04 December 2009 10:28 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-10
119 posts

Nice one. I’d call it more of a bug fix, personally wink

It’d be nice to have an extension which does a similar thing for updating relationship entries when duplicating sites using the MSM.
I recently had to solve this on a project by manually building a script to do the task of updating the exp_relationships table to fix several hundred rows in the table, each time I duplicated a site (of which there were 24). Very messy.

Anyway… off topic!

Good work smile

 
Posted: 15 December 2009 03:34 AM   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-02
982 posts

Hi,

I released version 1.1 of Retroactive Parents extension.

In this release a bug was fixed - extension not being able to find some parent categories which can be made retroactive in case nesting of categories is more than one level deep.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number