Feature request: Hide content from RSS for entire category

Creating and modifying plugins.
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Feature request: Hide content from RSS for entire category

Post by Don Chambers »

The extended properties for entries plugin already allows hiding individual entries from rss feeds. I could really use the ability to hide all entries assigned to a particular category. This allows me to have a category whose content is somewhat meaningful when seen on the blog, but not have that category's less important content compete with my more important content in an rss feed.

I see this implemented as a checkbox on the category creation page labeled "Hide content in RSS" (just like it is for entries), defaulting to unchecked.

Is this doable?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Feature request: Hide content from RSS for entire catego

Post by garvinhicking »

Hi!

This is thrice doable, a good feature request, but also a bit of challenging work. :)

You might want to add this on the SF.Net Feature Request tracker so that it won't get lost!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I ain't adding it anywhere - I'm counting on Super-Garv to save the day!!! :lol: :lol: :lol: :lol:

Despite my immediate need, I only asked because I can see how this could be a nice thing to have. Sometimes you want to include some content that is not really your blog's primary focus, which is great for a visitor, you just might not want that "less than optimal" content to be competing with your "real content" in the feed environment.

Anyway, rip open that Clark Kent suit and continue to save the world!!! :wink:
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Please somebody else add that to the RFE tracker. You will get notified by SF.Net if someone commits a fix for it, which is the reasons why I should not add it to the tracker with my account.

I would like to introduce that feature, but it might take me until august, as the next 3 months will be swamped with me doing my motorcycle lessons and having a loaded work schedule - so my spare s9y time might be reserved for supporting this forum here and fixing bugs. New features will need some fresh developer power, where I'm offering my help of course. :)

Of course, currently you could already fix this by patching your rss.tpl files and adding smarty IF-checks to check the categories, and omit them if it does not fit...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I didn't want this functionality to be template specific, so modifying the rss tpls is out of the question. I added it to SF, but certainly hope it can be addressed sooner than 3 months.

Motorcycle lessons????? :P Now there's an interesting visual - supergarv on a crotch rocket!!! :lol:
=Don=
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Hmmm. If the entry is in multiple classes, and one of them is the hidden category, should the entry be hidden or shown? And how do we make that preference understood in the option language?

And do we want to add this to the entryproperties plugin, or somewhere else?
Judebert
---
Website | Wishlist | PayPal
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Well, my theory is that if an entry is assigned to multiple categories, and ANY of those categories is marked as "hidden", the entry is hidden from rss. Not sure what you mean by "being understood in the option language"... do you mean translating "Hide content in RSS"? If so, that is presumably already defined as it is used in the extended properties for entries.

I wonder - would it be a simple matter, or difficult, to mark that existing entry field/checkbox for an entry at the moment it is assigned to a category that has been flagged as hidden from rss????
=Don=
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

You're reading my mind. And yes, I meant the description of "Hide in RSS?" indicating whether the category is hidden or not when one of multiple entry categories.

The current implementation actually removes entries from the feed before displaying them. That means your limit could be broken: if you said 3 entries in the feed, and all of them were hidden, you could wind up with an empty feed.

I'm thinking about moving the exclusion to the SQL. serendipity_fetchEntries is used, so we get a hook. But the hook data doesn't include any indication whether it's an RSS or normal fetch. I suppose I could check the $serendipity['view'] variable...

Garvin, my SQL is weak. What would be a good condition/join to exclude an entry if ANY of its categories matched a hidden category?
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, something like:

Code: Select all

...
LEFT OUTER JOIN hidden_categories AS hc ON hc.categoryid = c.categoryid
...
WHERE ISNULL(hc.categoryid)
?

hidden_categories would just have a list of category-ids that are hidden. You could also draw that from the serendipity_category DB table if you add a new column to it (which should better be avoided).

You can detect if RSS is used, the entryproperties plugin does that. I think it checks for some kind of RSS view, yes.

And trust me, I am truly fond of the crotchrocket idea currently :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Actually, while I was looking in the entryproperties plugin, I found that it uses the RSS hook and removes any hidden entries from the list. That's why I tried to come up with something better.

Thanks for the SQL. I'll see if I can do anything with it. I hate the idea of creating a whole new table, but if that's what it takes...
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

If you take the "Categorytemplates" plugin as a foundation (which I strongly suggest!) you could use the existing table that plugin uses for template-related options already - that might reduce the overhead impact. Plus, this feature would fit pretty well into that plugin.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Don,

I've started working on this, and I've hit the first concept problem. I know you were thinking of marking an entry as hidden if its category is hidden; that way the hiding could be overridden on a case-by-case basis.

That means the Extended Properties of Entries plugin would also need to be installed. Not a big deal, and not the problem, just a gotcha. I'd find some way to determine if it's installed and ignore the option otherwise.

However, there is a problem when a category is updated. When it becomes hidden from RSS, I could easily find all the entries in the database that are assigned that category and mark them hidden. But when it becomes unhidden, it's a lot harder to determine if the entry should be unmarked! I can't tell if the entryproperties plugin set it hidden, or another category, or myself...

So I think I'm going to go with the easier concept: if the entry is in any hidden category, I hide it from RSS. Good enough?
Judebert
---
Website | Wishlist | PayPal
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I see your point... in fact, I see it even better when I imagine an entry belonging to more than one category, each of which was marked as hidden.

While being able to selectively unhide a particular entry from rss, even though it's category is marked hidden is valuable (and consistent with how other entries are hidden from rss) - I cannot think of an easy way to avoid the conflict. If no one else can either, I suppose there is little choice other than to pursue your suggestion.

Thanks for taking the time to look into this!!
=Don=
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Garvin, I need more SQL-fu.

I tried adding a column to categorytemplates called hide_rss, and it works... but only for single-category entries. Multi-category entries still get displayed.

The SQL looks like:

Code: Select all

$joins[] = "LEFT OUTER JOIN {$serendipity['dbPrefix']}categorytemplates as ctpass ON (ec.categoryid = ctpass.categoryid)";
$conds[] = "(ctpass.hide_rss IS NULL OR ctpass.hide_rss = 0)";
Am I going to need a subquery to eliminate entries whose categories include one or more hidden ones?
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I believe you'll need to work with an aggregate function like "AND sum(ctpass.hide_rss) < 1) (or > 1?) to make sure that if you get multiple categories, a single removal will remove the whole entry record...

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply