Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-02-05 17:25:52

superfly
Plugin Author
From: vienna, austria
Registered: 2008-11-12
Posts: 24
Website

fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

Always had the Problem that my editorial staff posted articles in the “wrong” categories. So I made myself a plugin which I wanted to share with the Community. Download from my website or my github page. Maybe someone might find it useful.

Changelog

Please uninstall Version 1.0 before installing Version 1.1 – The Plugin and Database Name changed!

Version 1.1 (6. Feb. 2015)

  • Changed plugin name from fw_cat_restrictions to fly_cat_restrictions to follow TXP plugin guidelines
  • Bugfix for Dropdown if section and category names were equal
  • Added Feature Request to show/hide restricted Categories on Write Tab. Set via checkbox on Plugin Setting page
  • Added CSS-Classes .restricted and .restrictedHidden for Option Tag in Dropdown on Write Tab

{ Moderator’s annotation: Edited topic’s title to reflect the new plugin prefix. – Uli }

Last edited by uli (2015-02-06 15:57:20)


<code>is</poetry>

Offline

#2 2015-02-05 17:37:13

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

Thanks for sharing :)

Offline

#3 2015-02-05 20:17:21

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

thanks. very useful!

ps you have a typo: “So often articles where published in the wrong places,”


…. texted postive

Online

#4 2015-02-05 20:37:59

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

Good to have that plugin, thanks! (Cool mini demo, BTW, the GIF.)

superfly, I installed fw_cat_restriction in my sandbox where much has happened over the years. One thing I have there is categories with names identical to section names. The plugin disables their entries in the sections dropdown (namely on the first selection of a section menu item that shall have some categories disabled). My layperson solution was replacing all 5 instances of option[ with select[id^='category-'] option[. But there might be smarter ways to achieve the same.

And, should you be willing to publish an amended version, please change your fw-prefix to a three letter one, there are many options left, the letter f is rarely used as a dev prefix.

Thanks again!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#5 2015-02-05 20:54:15

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

It would be nice to show only the allowed categories according to the choosen section.

Offline

#6 2015-02-05 21:10:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

Hey, nice. I wrote a tiny plugin similar to this, but mine is horrible (you have to hard-code the map for a start). So to have one with an interface to configure stuff is great, thanks for writing it.

candyman: can you hook a CSS rule in your admin-side theme that targets disabled options and sets them to display:none? Not sure if that works or if CSS is rich enough to be able to do this. If not, maybe superfly would be kind enough to add a class to disabled elements that theme authors can hook into. Perhaps even a configuration option to set style rules for such a class which could be included just on the Write panel (admin_side:head_end callback, testing for the appropriate $event)? There’d be no need for the hard-coded red background then, as the display mechanism would be user configurable.

uli wrote #288050:

please change your fw-prefix to a three letter one

fly is available :-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2015-02-06 09:15:03

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

This is very cool. Is there a way to hide instead of disabling the categories?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2015-02-06 15:16:28

superfly
Plugin Author
From: vienna, austria
Registered: 2008-11-12
Posts: 24
Website

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

I’m happy you liked my plugin!!! Sorry that I overlooked the Plugin Naming-Guidelines. Guess I will go with the fly prefix as Bloke suggested, seems to fit nicely for me ;-)

I released a new Version 1.1, please see the first post in the thread.

Thanks everbody for the feedback and the bug hints. If you still find bugs or have any feature requests please let me know.


<code>is</poetry>

Offline

#9 2015-02-06 15:54:32

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

superfly wrote #288047:

  • Bugfix for Dropdown if section and category names were equal
  • Added Feature Request to show/hide restricted Categories on Write Tab. Set via checkbox on Plugin Setting page
  • Added CSS-Classes .restricted and .restrictedHidden for Option Tag in Dropdown on Write Tab

Ah, great, thanks :)
I just added your prefix to the list.

Would any admin please set superfly’s user level to Plugin Author?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#10 2015-02-06 17:55:27

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: fly_cat_restriction Plugin: Restrict Article-Categories in Write Tab

uli wrote #288074:

Would any admin please set superfly’s user level to Plugin Author?

Done:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB