Recent Topics

[plugin] Remember Categories plugin

Started by on Jan 17, 2009 – Contents updated: Jan 17, 2009

Jan 17, 2009 18:53    

This little plugin will remember the last active category you used in a blog instead of returning to the Category with the lowest number next time you wrote a post.
If you write a post the cehcked Cat will be 2 (Welcome) if you didn't change that name. So you must deliberately set your Cat if you want to change that. Wouldn't it be easier if it just remembered the last Cat you used.

See this post for a hack: [url=][Solved] How to suggest another category?[/url]. Thanks to sam2kb for pointing in the right direction.

AstonishMe and Amazing Discoveries teamed up and wrote this little gem that remembers the state of the Category and Extra Categories. So simply install this one and you'll never accidentally write your posts in 'Welcome' again.

Download: [url=]remember_cat_plugin_0.3[/url]

Have fun

Jan 17, 2009 20:54

Got an error trying to make posts from images (file manager)

Fatal error: Call to a member function set_setting() on a non-object in /../_remember_cat.plugin.php on line 102

Jan 17, 2009 21:19

Please try in line 121:

if ($this->Settings->get ( 'extra_cats' ) && $Blog->get_setting ( 'save_extra_cats' )) {

If you didn't generate or edit a post this setting doesn't exist (yet). I think that's the issue.

Better would be to instantiate the setting upon installing the plugin. Will see to that.
Thanks for reporting.


Jan 17, 2009 21:55

The fix doesn't work.

you need something like this...

function AfterItemUpdate($params) 
	if( !is_object($params ['Item']->Blog) )
		$BlogCache = & get_Cache( 'BlogCache' );
		$Blog = & $BlogCache->get_by_ID( $params['Item']->blog_ID );
		$Blog = & $params['Item']->Blog;
	$Blog->set_setting ( 'save_main_cat', $params ['Item']->main_cat_ID );
	$Blog->set_setting ( 'save_extra_cats', implode ( ',', $params ['Item']->extra_cat_IDs ) );
	$Blog->dbupdate ();

It doesn't use "last selected" category anyway, but at least it fixes the error :|

Jan 17, 2009 22:36

I was thinking something during plugin install but that won't help. Or at least it would need to loop through all available blogs.
I want to see if ¥åßßå can narrow this down to a oneliner. :p


Jan 18, 2009 07:54

if( empty( $params['Item']->Blog ) )



Jan 20, 2009 06:05

Please forgive me for asking without testing, but will this remember both main-cat and any sub-cats?

Jan 20, 2009 11:08

Sweet plugin Afwas... oh, and le "blonde".

Form is loading...

Advanced CMS – This forum is powered by b2evolution CMS, a complete engine for your website.