‘Category Visibility’ Plugin for WordPress 2.0.x
I needed a plugin that would display Posts only from certain categories. I found an earlier version of this plugin and modified it for my needs; now I’m sharing it with you.
A good example of Category Visibility is this very website. It’s purpose is to serve my web customers, most of whom wouldn’t have any idea how to install a plugin. I didn’t want plugin Posts to show to my regular users, but wanted to make the plugins available to other WordPress users who would want them.
See all of our WordPress Plugins
I created a WP Plugins category and unchecked “Front” and “List.” This keeps the Pages off the home page, and the listing off the sidebar.
The “WordPress Plugins” link above illustrates the point. It’s a link to the category page, which lists the plugins. You can see the category page and the associated Posts just fine. But that category does not show up in the sidebar, or on the home page.
This way, you get access, in fact, anyone can search for them and find them. But they’re not “out there” on the home page or in category links in the sidebar bothering my regular users.
History
I was using a Wordpress plugin called Category Visibility (Keith McDuffee) which was written for WordPress 1.5.
It had a few odd points like when it filtered posts off the Home Page that was okay but it didn’t replace them; that is, if your front page was supposed to show 10 posts and two were filtered out, you’d only get eight posts.
I changed that to run a select that does the filtering; as a result you get the full 10 posts.
There were a few other tricky things.
With WordPress 2.0, user levels are diminished and replaced with Roles. In some ways, this is better. If you’re not using any other old plugins which require numeric user levels, you have even more control. Use Owen Winkler’s Role Manager Makes it easy to add Roles and change the user level number associated with a role. Then use Category Visibility to control what those users see. A numeric code makes it possible to add permission to more than one user Role with a single entry.
Return category archives when called by cat ID. the original author must have used permalinks, because it wouldn’t work without permalinks. And there was some kind of problem if you had the category as part of the permalink. I’m pretty sure that’s been resolved.
Handle empty entries, that is, categories where no Category Visibility rule has been set. If you set up a new Category, you had to go to Category Visibility to set the user level, or it wouldn’t show. Now, that’s not required. By default, categories are visible to all.
CV was excluding Pages from search results when the Page was associated with a Category which was not supposed to be visible (Uncategorized). Since Pages aren’t really part of the Post/Category system, we don’t want them excluded, so I fixed that.
Allow administration only to those who have a Role that can Manage Categories.
Upgrade from the older WP 1.5 Category Visibility (0.31 by McDuffee). If you upgrade, be sure to deactivate the old plugin, then activate the new one, to initiate required changes to the database. You’ll also need to reset the visibility choices; this new version uses an entirely different table, purely to allow you to step back to Keith’s version if you prefer.
This plugin only works in WordPress 2.0. (Currently not compatible with 2.1.)
Instructions
Simply download and unzip it.
Put it in your plugins directory.
Activate it.
Go to “Manage,” “Category Visibility” to see the visibility settings for all categories. the options are:
- Front: Posts show up on the main (home) page.
- List: Categories that will show up in the List of categories in the sidebar.
- Search: Posts show up in search results.
- Feed: Posts show up in the main RSS/Atom feed.
- Archive: Posts show up in archive links (i.e., clicking on the calendar links)
Everything is checked to show up by default.
When you have a category to exclude from the front page, or the sidebar, etc., go to “Manage,” “Category Visibility,” and deselect the areas where you want the category to disappear.
This method is not designed as a security device, only as a display method. A guest can still access a post by post number.
Download
Latest version, WP 2.0.x: Ver. 1.0.0e.
- Added a function, cv_get_posts(visibleto), which duplicates the WordPress get_posts() function except that when a category is not passed, it returns posts in visible categories only. Defaults to those visible in ‘list,’ but can be changed using the ‘visibleto’ parameter.
A 2.1/2.2+ version that might work for you? Due to the urging of early adopters, I hacked at the catvis system to see if I can get it to work with 2.1. Here’s an early copy. It won’t hurt anything. But, from the comments I received, it probably won’t do the job. (I use WP 2.0.) MySql 4.1 no longer required for standard use. Download Beta9.
Some folks had suggestions, which I incorporated into Beta 10. Download Beta10.
One user has updated this for 2.3. (I haven’t tested this because I have NO 2.3 systems. Check:
http://www.tastycornbread.com/category-plugin/.Alas, everyone wants to know when the new version will be ready. It probably won’t. As I was testing the 2.1 version WP released 2.2 and I realized I can’t keep up. Still, some folks are finding this very useful, so I’ll keep it here for you and maybe someone else will pick up the ball.

















February 16th, 2006 at 1:57 am
Hi,
I was trying to get the Private Categories 2 plugin to work on my site, but it kept breaking in IE.
Found your plugin through a search and it works like a charm!
Great work and thanks!
February 20th, 2006 at 7:34 pm
Thanks, it seems the original author has dropped this project. Your work is very much appreciated.
February 20th, 2006 at 7:56 pm
Update: I found a bug.
You need to add support for child categories. That is, categories that are made under a parent.
If you get that fixed it is perfect.
February 20th, 2006 at 10:27 pm
Thanks a lot for updating this essential plugin!!! I was starting to be afraid that I’d have to rebuild my whole site until I read your message at gudlyff’s.
And many thanks also for your improvements, specially for the default visibility for new categories.
Maira
February 21st, 2006 at 9:37 pm
Thanks, all.
Luis, caught the child cat bug. (Would a child cat be a kitten?) Squished the bug and uploaded v. 1.0.0a.
Maira, thanks. That drove me nuts. Also, when you’d set up a new system and activated the plugin everything was fouled up til you went in and initialized the database. Now it’s created when you activate the plugin.
Rich
March 2nd, 2006 at 11:23 am
Category Visibility seemed to be creating a lot of mysql queries, so I modified it a bit to cache results and it made a difference. In my somewhat high-overhead theme it reduced the query count by about 18, which I consider significant.
So, if you want a Category Visibility that runs faster, download 1.0.0b.
Rich
March 4th, 2006 at 9:35 am
Great! I also ran into the Filter problem with Keith’s plugin. This one worked as a out of the box replacement.
THX
Martin
March 6th, 2006 at 1:29 am
Thanks for carrying on with this plugin. It’s of definite value.
Any chance you’ll add support for turning on/off visibility of pages for wordpressers using list_pages or wp_list_pages in their sidebar. It would be great not to have to muck around in code in order to display/exclude particular pages.
Thanks!
March 6th, 2006 at 1:54 pm
Rena,
About “..support for turning on/off visibility of pages for wordpressers using list_pages or wp_list_pages in their sidebar…”
I think that would be a different animal. (Not a catt plugin.) You’d have to check for a specific custom field or template to exclude the Page from the list.
March 10th, 2006 at 2:17 pm
found another bug.
When you have multiple loops set up on your front page, your plugin does not just kill the category from showing up in main loop, it kills them from showing up in any loop on the front page.
one plugin i found that avoided this was: RumCategory,
however, it is not nearly as robust as this one, therefore i would hope that you could arrange it to only kill the main loop in index.php
March 10th, 2006 at 2:33 pm
Upon further inspection, i have found that this issue is only created when making the “archive” invisible, all of the other options behave as they should when un-ticked.
The solution is in somehow allowing users to hide posts from the archive, without completley eliminating the category all together (which is what the plugin in is seemingly doing ).
March 10th, 2006 at 2:41 pm
Well, we could debate whether or not that’s a bug, but that would serve no clear purpose.
It’s our intention that when you uncheck something off the front page, that it is, in fact, off the front page.
The ‘list’ is supposed to refer to the sidebar.
We run two loops on many of our fromt pages, the first is the main loop, the second is an “additional headlines” loop. We expect excluded categories to be excluded there, too.
I can understand that there might be cases where you’d want something else. You’d probably need to modify your index.php to set some kind of a a flag and modify the Category Visibility plugin to not react when the flag is set.
Now it just recognizes that it’s the home page (through a process of elimination) and works accordingly.
About the archives business, that has created a number of perplexing situations. We’ve somehow fixed most of them, but a few persist. I’ll probably go look at that sometime; can’t promise when.
Note that there’s a little internal function in there now called cv_visible_cats(). It takes one parameter, a string that says front, list, seach, feed, or archives, defaulting to front. This returns an array of categories visible to the respective area.
It might be possible to use that for special purposes; we do that.
// cats visible to front page$acats = cv_visible_cats('front');
$catlist = '';
foreach ($acats as $category) {
$catlist .= ' ' . $category->cat_ID;
}
March 13th, 2006 at 7:20 am
hmm, not quite sure if i know how to implement that the right way, however i have used this in conjuction with your plugin by not hiding anything from the archives in your UI, and then going in and hiding them manually in my index.php
here is a sample of my code:
< ?php if (is_category()) { ?><h2>< ?php _e(’Archive for’); ?> < ?php echo single_cat_title(); ?>
< ?php } elseif (is_month()) {$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;query_posts("paged=$paged&cat=0,1,2,3,4,5,6,7,8,9,10,11"); ?>
<h2>< ?php _e('Archive for'); ?> < ?php the_time('F, Y'); ?>basically i am telling wordpress what categories to show at any given time, whatever category numbers arent listed above, are not displayed. This however is a hassle, so please fix yours :P
hope this helps
March 14th, 2006 at 9:08 pm
When the plugin is activated, and i turn off certain categories from the archives it still displays the months where the certain categories are but then when the months are clicked on it says the page you are looking for is not there. Is there a way to make the month not be displayed if the category is turned off?
March 18th, 2006 at 9:44 am
Great plug-in! Thanks.
I think I’ve found a problem though; I have a category with a apostrophe in its name: ‘Jobs I’ve Known’. With the plug-in operational that category does not show up in the sidebar (even though all the checkboxes are ‘on’). If I edit the category name to remove the apostrophe, the category appears correctly. Any way around this?
Mike
March 23rd, 2006 at 7:06 pm
Thank you so much!
June 13th, 2006 at 6:55 am
Awesome!
Thanks Rich, just about perfect. What would be great is to have a ‘per post’ option. Meaning that when I write my post I can set whether I want it on the front page or not (but still have it publish to cats). There is something similar to this in mambo/joomla.
Thanks anyway. Great plugin, easy to use!
Rick.
June 14th, 2006 at 10:46 pm
Excellent plugin!
However - for those of us looking for extra discretion, it would be even more excellent if there was a way to turn off visibility in the calendar as well. I have a test category “invisible” and deselected all of the visibility options for it, but the post I just wrote in that category still causes that day (today, 6/15) on the calendar to become a link, and a mouseover shows the title of the post. Just a thought for any future revision - suggestions for a hack welcome. :-)
June 15th, 2006 at 2:44 pm
This is very sweet. I was wracking my brain (and the support forums) trying to figure this out until someone linked me here. I haven’t implemented it yet, but just reading, it’s exactly what I was looking for. Keep me posted of any updates!
June 15th, 2006 at 2:50 pm
D’oh! I just installed it, and as I was doing so I thought to myslef “hmmm, I wonder if this is going to work with Sideblog 2.0 (By Kates Gasis)” and sure enough, it doesn’t. Had both activated and it snafu’d on yours, deactivated Sideblog and the main page works but now no ‘updates’ sideblog in the sidebar. Any thoughts?
June 16th, 2006 at 10:20 am
It doesn’t work well with Sideblog.
June 17th, 2006 at 2:54 am
I don’t use sideblog, but I get the following error using Ver. 1.0.0c on WP 2.0.3:
WordPress database error: [Not unique table/alias: 'wp_post2cat']SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND post_date_gmt <= '2006-06-17 09:52:59' AND (post_status = "publish" OR post_author = 1 AND post_status != 'draft' AND post_status != 'static') AND post_status != "attachment" AND ((wp_catt_visibility.front=1 AND wp_catt_visibility.cv_user_level<=10) OR post_status='static' OR wp_catt_visibility.catt_ID IS NULL) AND (category_id = 2) AND (post_end_date >= '2006-06-17 23:59:59' OR post_end_date IS NULL) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 6
Any ideas what is going on? All I need to do is NOT allow a couple of my categories in the main blog RSS feeds.
June 17th, 2006 at 12:19 pm
Yoyo, you’ve got the same problem as JP with Sideblog, something’s combining the calls so you end up with two
LEFT JOIN wp_post2catstatements in the join portion of the query.It’s probably some other plugin that adds the second LEFT JOIN without checking that one’s already been put into play. (In CatVis we check that before adding the join.)
June 17th, 2006 at 2:51 pm
Hi, thanks for the great plugin. However, it doesn’t seem to work when multiple categories are assigned to a post (e.g. one removed from index page, while another is not).
Is there any way so that a post can be removed from the front page as long as one of its categories has been set as invisible?
Thanks in advance.
June 17th, 2006 at 4:42 pm
Alas, this is one major flaw with the visibility issue… one I hope to have time to tackle sometime.
In fact, there’s more to it than that.
Some folks, like you, think a post shouldn’t appear if ANY category is set to invisible, and others think it should be visible if ANY category would make it visible.
I happen to fall in the latter group.
Suppose you have a post that’s appropriate for “members” and for “evaluators.”
You’d want it to appear for evaluators even if members was restricted from the home page. Or sidebar list. Or whatever. Well, that’s what I’d think.
But, as it is, mysql picks one and uses that. So with multiple categories, anything can happen.
Sorry about that.
June 18th, 2006 at 12:09 pm
Brilliant!!!! I’ve been trying to solve this problem for days, was pointed to your plugin and voila. Done in 5 seconds. Peace, Love and Plug-ins!
June 19th, 2006 at 10:56 am
Thank you. This is excellent work and should be referenced on the WP website for plugins. Had to search for a couple of hours and even install the original version before finding this one. I have an “Opinion” catagory, where I like to vent once in a while, but I don’t want to force people to read it when they first hit my page (only if they really want to subject themselves to my point of view).
Thanks again for all the time you spent developing this and making it available for everyone.
June 25th, 2006 at 6:00 pm
I am using K2 and widgets plugin for the sidebar and I also have your plugin activated.
When I click a catergory at the sidebar, I get the following error:
[Unknown table ‘wp_post2cat’ in on clause]
SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) WHERE 1=1 AND post_date_gmt <= ‘2006-06-26 00:57:59′ AND (post_status = “publish” OR post_author = 2 AND post_status != ‘draft’ AND post_status != ’static’) AND post_status != “attachment” AND ((wp_catt_visibility.archives=1 AND wp_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR wp_catt_visibility.catt_ID IS NULL) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 5
When I turn off your plugin.. everything goes back to normal. Any advise?
Thanks
June 25th, 2006 at 8:01 pm
Kelvin, I think version c will help… download it!
June 26th, 2006 at 7:49 pm
Works like a charm! I needed a solution like this… a five second google search, a ten second read of some WP Forum posts, a quick download, a quick install… it took less than five minutes to have a problem, find a solution, install it, and have the problem solved.
Days like this, I really love the internet — and folks like you, who create plugins and offer them for free to the community. Great job.
June 28th, 2006 at 5:22 pm
Rich, thanks for the tip, the c version works!
July 3rd, 2006 at 3:29 pm
there are some issues with David Coppits Category Order (http://www.coppit.org/code/) This will keep on working, whilie his hide all the cats if this is installed.
July 5th, 2006 at 7:42 am
Just like everyone else said, this solved a problem I had been pulling my hair out about for hours - excluding more than one category from the front page with “query posts” is more difficult than it has to be!
But this is even better. Thanks!
July 9th, 2006 at 2:53 am
This plugin is great :) But I’m wondering if it’s possible to still show a hidden category in a seperate section of the page ie. I have two loops running, one for a devoted category, dont want to kill it all together.
July 14th, 2006 at 3:02 am
Great plugin. One minor problem - it doesn’t hide the posts in my sidebar. I have created a “privatetest” post allocated to a “private” category to test and this post doesn’t appear on the home page, but does appear in the sidebar.
My sidebar code is below:
Recent Posts
<ul class="posts">
<?php BX_get_recent_posts($p,20); ?>
<A href="http://www.marcuscake.com/sitemap/">View all posts (sitemap)</a>
</ul>
I suspect the BX_get_recent_posts function may not be typical.
The following is from the BX_functions.php file:
function BX_get_recent_posts($current_id, $limit)
{
global $wpdb;
$posts = $wpdb->get_results(
"SELECT ID, post_title FROM "
. $wpdb->posts . " WHERE post_status='publish'
AND post_category=='17' ORDER BY post_date DESC LIMIT " . $limit);
foreach ($posts as $post) {
$post_title = stripslashes($post->post_title);
$permalink = get_permalink($post->ID);
if ($post->ID != $current_id) echo "<li><a>" . $post_title . "</a></li>\n";
}
}
Can anyone make any suggestions? Thanks for your help in advance.
July 17th, 2006 at 3:58 pm
Just as info:
I also had the conflicet with two LEFT JOIN.
Did a disable of the plugin ‘Front Page Categories’ (ok plugin, but manual edit in php file).
Very fine plugin you made here.
Regards
July 24th, 2006 at 4:20 pm
gracias justo lo que estaba buscando!!
July 29th, 2006 at 5:02 am
Excellent! Worked like a charm. :)
July 31st, 2006 at 2:09 am
I’m using your plugin. But all the posts in the hided category appears in the rss feed, and you can read all that posts with a direct link.
August 2nd, 2006 at 12:36 am
Hi,
I’ve got the same problem. The category is hided, but in the rss feed the post appears-
is there any fix for that problem?
August 2nd, 2006 at 4:19 am
i have same problem with sideblog, i realy need both (sideblog and catvis) what can i do?
August 2nd, 2006 at 10:34 am
Franco and Florian, when I uncheck “Feed” the stories disappear from the RSS feed. If you’re not getting that behavior, it must be due to some other plugin or modification on your system.
Hadi, sorry, we have no solution here for plugins that don’t use the standard hooks.
August 3rd, 2006 at 2:22 am
Woohoo! Worked like a charm! Nothing can describe my relieve now. Heh heh… until it breaks (have not checked the feeds, search, etc.), of course. =P
Well done!
August 3rd, 2006 at 2:42 am
Oh, just one problem.
If some smart alec did something like http://myblog.com/category/private , apparently all the private entries will appear. Any idea?
Cheers!
August 3rd, 2006 at 3:48 pm
Hi Rich
Just wondering if this Category Visibility plugin can be made to work with Subscribe2 plugin - what I need to happen is the list of categories in the subscription page to be restricted by the level of the user, as would happen anywhere else on the site, but not in the admin panel it seems.
To be more general - I want to be able to restrict the categories shown to a user even in the admin panel. Is this at all possible?
August 3rd, 2006 at 3:59 pm
Upekshapriya, you might try editing the source code. As it is, the admin panel gets everything.
CatVis has never been a “security” feature, actually, more of a “display appropriate material” kind of thing.
That said, in version c, around line 205, are a couple of lines that you might try commenting out.
August 3rd, 2006 at 4:15 pm
Just discovered that neither version seems to be working on a post in a category that’s restricted to user level 10 under a couple of conditions (when logged out completely).
The post is shown in the sidebar when I list the titles of the latest posts with wp_get_archives(’type=postbypost&limit=5′)
Using the permalink to the post provided by above condition the post shows fine on its own.
Thought that might interest you
August 3rd, 2006 at 4:25 pm
Rich, sorry I didn’t see you post before I wrote the next one.
Tried what you suggested in commenting out lines 205 and 206 to no effect. Also commented out 189 which had the same reference. This didn’t work either (ie all these lines were commented out). Maybe it’s a lot more complicated to do it?
August 3rd, 2006 at 6:58 pm
Hi Rich,
Oh, I forgot to mention that I was using v1.0.0c that allowed readers to key in the URL http://myblog.org/category/private to read all the posts in what apparently is a private category.
However, it seems that v1.0.0b didn’t have this problem. When readers tried something like that above, they have a page not found response, which is perfect.
May I know which is the expected behavior?
Cheers!
August 10th, 2006 at 2:40 am
Hi Rich,
Thanks for the plugin. Works very well until I use it with Category Order v1.9.4 by david Coppit. Not only do I need to hide a category from the side bar, but I need to put them in a specific order.
Andy ideas?
Best regards!
August 16th, 2006 at 2:37 pm
Hi, when I exclude certain categories (from the frontpage, archives - everything), I can still see the posts when using the tag “get_archives”. I guess this exclusion only works in the real archives page? Too bad.
August 19th, 2006 at 7:23 pm
Hi there, thanks for the plugin. Very useful, however it behaves strangely when I try to display an unordered indented list of my categories, subcategories and sub-subcategories. The first category displays in bold as intended, however every other category acts as if it is a subcategory of the first one ….
Tried both versions of the plugin and they both do the same thing ..
Hope you can help,
cheers.
August 19th, 2006 at 8:03 pm
Have found a fix for my problem, a bit clunky perhaps, but it works for 2 levels of subcategories:
At line 322, change the part of the for each statement as follows:
foreach ($linklist as $link) {if(preg_match("/class.children/”, $link)) {
$children = 1;
$newlist .= $link;
} elseif(preg_match(”/class.children/”, $link) && ($children=1)) {
$children = 2;
$newlist .= $link;
} elseif(preg_match(”/<\/ul>/”, $link) && ($children=1)) {
$children = 0;
$newlist .= $link;
} elseif(preg_match(”/<\/ul>/”, $link) && ($children=2)) {
$children = 1;
$newlist .= $link;
} else { ….. (ETC)
August 25th, 2006 at 4:28 am
wonderful. Definitely try to get this to be a default included feature for wordpress !!
August 31st, 2006 at 12:14 pm
When I activate the “category order plugins” and “category visibility” the category doesnt appear…
This could be fixed? Thenks…
September 1st, 2006 at 10:05 pm
pretty slick, but wanted to know if I can setup a way in which certain categories show up on certain pages only. For eg. If I have a category called News, can I get it to appear only on the ‘News’ Page? I checked the wordpress forums, but the code wasn’t quite helpful [ noob to php ], so some1 asked me to check out your plugin. Would really appriciate help in any extent possible.
September 2nd, 2006 at 8:26 am
Alok,
No, this won’t do that.
What you describe, well, that’s what WordPress category pages are, pages which display only posts for the specific category, i.e., yourdomain.com/?cat=5
September 4th, 2006 at 9:14 am
Hi Rich -
I see that typing in the permalink of a post as the URL causes the post to be displayed even if the category it belongs to is not visible to the user. Is this the expected behaviour? I am using wp2.0.3 and I checked both the b and c versions of your plugin.
Not sure how this happens since the loop in single.php (to display the single post) is similar to the loop in the main index template (if (have_posts()): while (have_posts()): the_post(); … ). Does this mean the filters you are adding to posts_join and posts_where are somehow not being called for the single post?
Any clarification would be very helpful. Thanks!
September 4th, 2006 at 2:34 pm
Yep, Nawaaz,
It’s not a security plugin, it’s just designed to control what shows up on front page, sidebar, etc.
You’d be correct in a need to understanding how single posts are called… especially with permalinks.
September 7th, 2006 at 4:08 pm
Hi Rich, im having a problem with calendar (or archive) links. They give me a “404 not found”, but they work if i deactivate the plugin. Im using the 1.0.0c with permlinks. And i have the right configuration in your plugin (actually, i have the the visibility on for all options).
What could be happening?
PD. Sorry for my english :(
September 7th, 2006 at 8:50 pm
Guillermo,
In the sidebar, you’ll see archives listed that have articles, but when you click the link you’ll get a 404 if all the posts for that month are in categories which have archive unchecked.
Recheck “archive” and the posts should show up.
September 8th, 2006 at 9:03 am
…And it works!!! I feel so lame!!! Thank you very much specially for your fast response!!!
September 8th, 2006 at 1:23 pm
Guillermo,
It works, but it’s not ideal. Maybe someday I’ll come across the reason an archive with only invisible category posts shows up in the sidebar. (I’m not using Archives in any of my websites, so it’s never been an issue for me.)
‘Til then, don’t feel lame, the plugin is lame in this instance.
September 15th, 2006 at 8:36 am
I noticed that this plugin has a conflict with the Sideblog Wordpress Plugin tht can be found here,
http://katesgasis.com/2005/10/24/sideblog/
Just wondering if that could be solved somehow.
September 15th, 2006 at 8:06 pm
hey rich, im having a problem.. its showing the hidden posts under my blog’s recent posts list on the right side of my page.. so ppl can still acess that post.. how do u get it to not show up on that menu?
September 17th, 2006 at 6:51 pm
GD,
Well, yes, that can be a problem, because WP’s get_posts() function pays no attention to this. I just posted a new version, 1.0.0d, which adds a replacement function, cv_get_posts().
This may also be the problem others have had with other non-compliant plugins.
Then you can use a function like this for Recent Posts:
function ryo_recent_posts($no_posts = 5,
$before = '<li>', $after = '</li>',
$skip_posts = 0, $cat = 0) {
if (function_exists('cv_get_posts')) {
$posts = cv_get_posts('numberposts='.$no_posts.
'&offset='.$skip_posts.'&category='.$cat);
} else {
$posts = get_posts('numberposts='.$no_posts.
'&offset='.$skip_posts.'&category='.$cat);
}
$output = '';
if ($posts) {
foreach ($posts as $post) {
$post_title = strip_tags(stripslashes($post->post_title));
$permalink = get_permalink($post->ID);
$output .= $before . '<a href="' . $permalink .
'" rel="bookmark" title="Link: ' . $post_title .
'">' . $post_title . '</a>' . $after . "\n";
}
}
echo $output;
}
September 20th, 2006 at 11:48 am
thanks!
September 27th, 2006 at 1:40 am
i have a problem, when i post an entry in two categories (example
“sports”: normal category, not affected by the plugin.
“other category”: set up for not showing the entry in the main/front page.
the entry still appears in the main/front page.
¿it’s any way to fix this?
September 27th, 2006 at 7:05 am
Albertojm,
See my comment of June 17, 2006, above.
September 27th, 2006 at 5:01 pm
hi,
thanks for your plugin!
there is a way to show how many posts are “visible” in front page after using this plugin?
(sorry for my terrible english!)
thais
September 27th, 2006 at 5:30 pm
In the loop, you can use count($posts) to get the number.
September 28th, 2006 at 8:05 am
thanks!!
September 29th, 2006 at 4:23 am
hi,
As said, great plugin. However, having an option to filter hidden posts out of the main page (I know they dont show up directly on main page, but when I click a post on main page, hidden posts are shown as next/previous) - and - to disable direct links to hidden posts would be really nice.
I know this wasnt supposed to be a security plugin. However, for simple applications (like mine ;) ) these options would make it one.
I just started a page for a kindergarden, and I simply want some contents to be completely hidden from unregistered/low level users, while I dont want to bother registered users with an additional password entry or even a browser login dialog for secured content.
Don´t you think, adding the two hide Options “Direct” and “Loop” (or whatever they would be called) would be a welcomed improvement to the plugin?
Kind Regards,
Sven
September 29th, 2006 at 4:25 am
Would do add this myself, but, unfortunately I haven´t the slightest knowledge in php right now (might change sometime ;-) )
Regards again,
Sven
October 3rd, 2006 at 10:25 am
I know this is a little advanced.
but testing this plugin with wordpress 2.1, when a post has multiple categories, it’ll appear in the loop multiple times.
for e.g. if a post has 3 categories, it’ll appear 3 times in a loop
Any suggestions on where I should be looking to solve the problem?
October 3rd, 2006 at 4:09 pm
I don’t have that problem in 2.0.4.
Multiple categories ARE a problem, however.
The first challenge is deciding what you want it to do.
- Show ‘em if ANY category is visible.
- Don’t show ‘em if ANY category is blocked.
Frankly, there are contradictory, yet logical and valid, answers.
Then comes the challenge with getting the code to work.
See comment by ZMang and my response on June 17.
October 11th, 2006 at 2:42 pm
ok i downloaded this plugin,i got the category not to show on home but how do i get it so it shows on another page?
October 17th, 2006 at 9:51 pm
Thanks for the great plug-in. Just what I needed.
October 24th, 2006 at 5:08 am
Like Luc I’ve got the same thing. All my categories that have private posts in them won’t appear in de wp_list_cats I would like to trigger my vistors on subscribing by showing them all the categories I have. As soon as they open the categorie (with private posts in it) the will be confronted with the log in/register page.
How do we un-hide the categories?
P.S.: It is a great plug-in!
November 1st, 2006 at 9:08 am
Great Plugin, just what I’ve been looking for.
I’m using it to filter the monthly archives down to showing the contents of just one category: however, there’s some functionality I’m not sure how to implement here.
Imagine I’m filtering to just show category A, and my site has two categories, A and B.
If I post in december to category A and category B, and in january post only to catogory B, my monthly archive list shows as:
DECEMBER
JANUARY
even though, with category B filtered out, it should show
DECEMBER
only, as January’s posts are all in the filtered category B. However, the standard wordpress call of wp_get_archives() doesn’t care. Does anyone have any idea of a workaround for this?
November 1st, 2006 at 12:41 pm
[…] As a last step I wanted to remove the “asides” category from showing up in my feed. I did this for several reasons but mostly because it’s what Kottke does and darn it, I wanted to do it too. Instead of more hacking — which I was tired of at this point — I just found a nice simple plugin and let it do the work for me. […]
November 6th, 2006 at 9:24 pm
I downloaded the lastest version. I this error with 1.0.0b also.
WordPress database error: [Not unique table/alias: ‘dc_post2cat’]
SELECT DISTINCT * FROM dc_posts LEFT JOIN dc_post2cat ON (dc_posts.ID = dc_post2cat.post_id) LEFT JOIN dc_catt_visibility ON (dc_post2cat.category_id = dc_catt_visibility.catt_ID) LEFT JOIN dc_post2cat ON ( dc_posts.ID = dc_post2cat.post_id) WHERE 1=1 AND post_date_gmt <= ‘2006-11-07 04:22:59′ AND (post_status = “publish” OR post_author = 1 AND post_status != ‘draft’ AND post_status != ’static’) AND post_status != “attachment” AND ((dc_catt_visibility.front=1 AND dc_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR dc_catt_visibility.catt_ID IS NULL) GROUP BY dc_posts.ID ORDER BY post_date DESC LIMIT 0, 10
I am not sure whats happening. any help would be get. Thanks
November 6th, 2006 at 9:53 pm
Danny,
You’re getting two
LEFT JOIN dc_post2catstatements which means you’re using another plugin that doesn’t protect against that occuring.CatVis is running first and adding the needed phrase, then the other plugin is running and adding a dc_post2cat join also.
CatVis checks for this conflict before adding the join to the join phrase, but it can’t keep another plugin from adding it later.
Try turning off other plugins, one at a time, to catch the culprit.
November 10th, 2006 at 12:47 pm
Hey there,
I downloaded the plug-in, but I seem to be having issues. As soon as I activate the plug-in, all my categories disappear from the sidebar. This is the code on the sidebar to call the categories:
Categories
As soon as the plugin is activated.. BAM.. that gets removed even though all the boxes are checked and user level = 0
November 10th, 2006 at 1:17 pm
Rupen,
Change the code in the sidebar to read
wp_list_cats('sort_column=name');November 11th, 2006 at 1:52 am
This is a very usefull plugin. Thanks for sharing it. I would have one wish, though: Could you please modify the plugin to show the names of the roles (subscriber, editor, admin, custom roles made with RoleManager) instead of numeric levels?
I guess - without studying code - that the fact that several role names can be assigned to the same numeric id might lead to the need of more extensive changes… but I am just looking for a nicer user experience, so perheaps substituting a role name list for the id would be sufficient…
November 11th, 2006 at 12:51 pm
Ralf,
The role names, with associated numbers, are shown at the bottom of the Category Visibility management page, just above the “Submit Changes” button.
November 15th, 2006 at 12:20 pm
[…] Rich Hamilton’s revision of Keith McDuffee’s original “Category Visability” is an excellent WP plug-in. It just doesn’t quite work the way I needed for the main Moshav HaAm site, which has relatively sophisticated needs for layers of content access, given our mandate to be as open as possible to a number of different valences of community and leadership. […]
November 15th, 2006 at 3:33 pm
Hi, I have activated the plugin, but it give me a problem. In the home page there is this text:
Catchable fatal error: Object of class wpdb couldnot be converted to string inC:\wamp\www\giofilo.com\wordpress\wp-content\plugins\category_vis-rh.phpon line 212Sorry for my bad english,
Thanks
November 15th, 2006 at 11:17 pm
First, thanks to Rich for a great plug-in! I can’t tell you how much easier it has made an otherwise difficult week.
Second, for those who (like myself) need different logic for the case of multiple-category posts, I have a working hack of Rich’s plug-in here. I reworked the database implementation so that a post will now be invisible if any of its associated categories are invisible for the current user. I also added the option of hiding posts from single-page view, and I made minimum user-level settings specific to each display area for a category rather than general to the entire category.
Use my version at your own risk. I’m using it in one project that is still in development. So far so good, but I’m no expert at WordPress architecture and I haven’t tested it very rigorously yet. If you do use it, please share your experiences with me. I suppose I most need to know whether it breaks; though it’s always more fun to hear about how it made your day brighter, teeth whiter, and children smarter. %)
November 16th, 2006 at 4:28 am
What I have to do for resolve this problem?
November 17th, 2006 at 12:21 am
Okay,
This is an AWESOME plug-in, but I am still an amateur in this whole thing. I am using category templates and I am implementing specific sidebars. I am having trouble coming up with a code to list the parent Category 12 with the children of that same category.
Any recommendations?!
November 24th, 2006 at 5:21 pm
ive tried this and when i click on a single post, using the previous and next links, it still allows me to see the category that i’ve marked hidden.
any ideas??
November 24th, 2006 at 5:59 pm
also, is there any workaround to show the hidden category on other sections of the site?
this whole wordpress category thing is really driving me insane. do you have any ideas on displaying the hidden category on a sidebar or something? ive tried this, but it doesnt work (i just get a blank page.. meaning php error?)
<ul><li><a></a> --- </li></ul>November 26th, 2006 at 10:46 am
Nice plugin, but it have some bug. If user will put url to browser by hand, he can see hidden post.
For example - visit my site page http://chingiz.org/archives/15
You can’t find this page from main or others menu, but if you will see to the numbers of public topics, you can find some numbers of hidden post.
If you plase that numbers after /archives/ - you’ll see “secret” post. At this time i hide content from hiddeh posts by other plugin :(
Headers of hidden posts anyway can see anybody.
Please, correct this. And then your plug-in will be the best for hidden zones and posts in WP blogs :)
November 27th, 2006 at 5:29 am
Hey, guyz, i see Joel Rothschild did what i want for upgrade this plugin. Nice work! Single pages now are really invisible! It’s working.
Thank’s for Rich and Joel Rothschild :)
November 29th, 2006 at 11:46 pm
how does the cv_get_posts() works? im using the function i tried to replaced it with cv_get_posts but it tells me is missing arguement error?
Thanks in advance
November 29th, 2006 at 11:48 pm
Oops sorry for the incomplete question.
How does the cv_get_posts() works? im using the function
get_archives('postbypost', 12);i tried to replaced it with cv_get_posts but it tells me is missing arguement error?
November 30th, 2006 at 7:29 am
L,
cv_get_posts() is similar to the WordPress template tag get_posts() function except that when a category is not passed, it returns posts in visible categories only.
It would not be a replacement for get_archives().
You can check get_posts() at
http://codex.wordpress.org/Template_Tags/get_posts
The
visibletoargument is added, defaulting tolistDecember 1st, 2006 at 2:35 am
Hi,
Great plugin. Exactly what I needed! Thanx so much!
There is one thing I noticed…when I unclick archives for say Category C. Now it disappears off the archives and the front page which is great. However, when I go directly to the category page, it doesn’t show any posts either. Seems like the posts just disappear. As soon as I click Archives back on, the category C page starts showing the categories again.
Am I doing something wrong?
December 1st, 2006 at 9:35 am
Great Plugin, worked like a charm.
December 1st, 2006 at 9:59 am
Erum,
You’re not doing anything wrong. Category pages are treated the same as archive pages by this plugin.
While that doesn’t affect me like it does you, it’s not ideal, so maybe I’ll do something about that next time I update.
You could go about line 253 and comment out the lines that read:
elseif (is_category())$where .= " AND (($cat_visibility.archives=1 AND $lc";To comment these out just add
//at the beginning of each line.That should work by allowing category posts to appear on category pages.
December 1st, 2006 at 6:53 pm
Bear with me.
I am combining three Blogger blogs and a LiveJournal into one WordPress blog on my website. I assigned the two subsidiary Blogger blogs as categories in the WordPress blog.
I want to present a peek into each of the original blogs on my homepage which I was able to accomplish with “feed2js”. However, after changing feed visibility on the two subsidiary categories, they disappeared not only from the main RSS feed, but apparently there is no category feed as well.
Does eliminating visibility of a category removed it from all feeds or is it only supposed to eliminate it from the main feed?
I can work around my problem, but I’d rather not if I can avoid it.
Thanks for a great tool.
Ciao for now!
Mike
December 1st, 2006 at 8:17 pm
Mike Murray,
The test is
if (is_feed())so I’d expect it to remove posts from all feeds.
December 5th, 2006 at 7:11 am
i dont know what happened, i didnt touch anything i woke up today trying to access my blog and i get this error messaGE?
Catchable fatal error: Object of class wpdb could not be converted to string in
/home/atomicb/public_html/l/wp-content/plugins/category_vis-rh/category_vis-rh.php
on line 212
December 5th, 2006 at 7:25 am
nevermind, fixed it!
1. $cats=$table_prefix.’post2cat’;
2. //$cats=$wpdb.’post2cat’;
just uncommented the first 1 and commented the 2nd
December 9th, 2006 at 11:01 am
Thanks a lot - great plugin!
December 10th, 2006 at 11:12 am
Thanks, this plug-in works great! Actually, it’s more than I needed. It’s given me a couple ideas to improve my site.
Using this plug-in I’m adding advertising and notices about content found only on my site to my feed and notices about content only found in the feed to the site! Kind of cross-marketing to ensure maximum traffic.
Thanks
December 10th, 2006 at 12:33 pm
[…] Já tinha procurado por um plugin que não permitisse que os posts de algumas categorias do blog apareçam na página principal, e hoje encontrei este aqui, não sei se é a melhor opção mas veio em boa hora. Ele controla o aparecimento dos posts de uma determinada [/tag]categoria[/tag] na página principal, o aparecimento da categoria no sidebar, o aparecimento em resultados de busca e alimentação RSS, além de outros. […]
December 10th, 2006 at 12:35 pm
P.S. Did anyone ever figure out how to get this plug-in to work with David Coppit’s Category Order plug-in(http://www.coppit.org/code/)? Coppit’s plug-in let’s you indent categories so that they appear hierarchical, but when both your plug-in and Coppit’s are installed categories disappear all together.
December 11th, 2006 at 10:28 am
HI!!! :)
I recently downloaded your plugin today; however I am having problems with it. When I go to ‘Manage’ I don’t see any “Catagory Visibility” in my Wordpress. Ever since I downloaded Keith’s catagory visibility, I can’t see anything (concerning this plugin/or something similar to it) in my “Manage” area with my wordpress. Has anyone else had this problem? Any help or feedback would be appreciated!
December 12th, 2006 at 1:54 pm
What I want to do on my blog, is every few hours take the oldest post and move it to the
front of the queue, all automatically. Anyone know if there is a plugin that can do this or
a simple way to set up another plugin to do this (use my own feed perhaps)?
Thanks.
December 14th, 2006 at 4:27 pm
Alberto,
See the Oldest2Newest plugin at: ryowebsite.com/wp-plugins
December 15th, 2006 at 6:09 pm
Rich, Have you updated the plugin to display sub-categories correctly? I tried the hack posted by Linda K (19 August) but it brings up the following error:
Parse error: parse error, unexpected T_CLASS in D:\Domains\go.id.au\wwwroot\wp-content\plugins\category_vis-rh.php on line 339
Line 339 is
} elseif(preg_match(”/class.children/”, $link) && ($children=1)) {
Any suggestions?
Gary O
December 15th, 2006 at 9:17 pm
Well, Gary O,
I was happy Linda K was able to solve her problem, because it works great on my websites. Displays categories and subcategories just fine.
And I can’t vouch for her hack.
It must have something to do with the theme or other plugins that she and you are using.
December 16th, 2006 at 1:51 pm
Hi,
I am not a technical person, so I am afraid to install this plug-in if it does not do what I need. So here is my question. What if I don’t need to hide categories, rather, I just want certain posts to bypass the home page and go directly to a category. Can it do that?
Thanks!
December 16th, 2006 at 3:58 pm
Hi,
I think I figured it out. I installed it on my test blog and if I only uncheck “front”, the post goes directly to a category bypassing the front page. My question is, could this be considered “cloaking” by Google and other search engines?
Sometimes I actually do need for a post for that same category to appear on the home page. I display 10 posts on the home page.
For example, I posted something for that category a few days ago and it is still on the home page, now I need a new post to go directly to that category bypassing the home page.
If I uncheck “front”, that post (which was posted a few days ago and still on the home page) disappears.
Is there a work around? Thanks!
December 17th, 2006 at 5:37 am
[…] Category Visibility-RH Rev Alter the visibility settings for categories, for WordPress 2.0. Based on an earlier Category Visibility by Keith McDuffee. By Rich Hamilton. […]
December 18th, 2006 at 2:59 pm
I
ve been so happy yesterday to find this plugin. Now I found a little problem that perhaps might be solved very easy. Dont know.There is a blog (not mine) where I installed your plugin to make only one special category unvisible. The mission was to write articles to be shown only on the home page so that the owner of the blog would be able to edit his home page whenever he likes.
Works fine. But today I had a look into the RSS archives page where all categories using wp_list_cats(’…&feed=RSS’); didn`t show up anymore. Everything is possible with wp_list_cats but not the feed option.
Just found out that the plugin shot the whole category list to hell… ;-)
Would you please give me a hint how to fix that?
December 19th, 2006 at 5:44 pm
Building a site based on WP for a client and love the idea of your plugin. Theoretically does exactly what I need. However when I activate it, I get the following error. Thoughts on what is wrong. I am only an intermediate user of PHP and extermely new to WordPress. Any help would be appreciated.
WordPress database error: [Not unique table/alias: ‘wp_post2cat’]
SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) LEFT JOIN wp_post2cat ON ( wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND post_date_gmt <= ‘2006-12-20 00:42:59′ AND (post_status = “publish” OR post_author = 1 AND post_status != ‘draft’ AND post_status != ’static’) AND post_status != “attachment” AND ((wp_catt_visibility.front=1 AND wp_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR wp_catt_visibility.catt_ID IS NULL) AND category_id NOT IN (2) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 10
December 19th, 2006 at 5:51 pm
Nevermind. Another Plugin was conflicting with it. After five looks through the other posts I found a similar issue with your response.
Thanks,
December 20th, 2006 at 10:08 pm
Hi There,
Great plugin you’ve developed here - I noticed that it doesn’t work with David Coppit’s “Category Order” plugin. I’m wondering if there are any other Category Order plugins that might be compatible?
Cheers,
Peter
December 23rd, 2006 at 5:32 pm
Thank you.
December 28th, 2006 at 5:17 am
Thanks… that’s exactly what I need. You’re the man.
January 1st, 2007 at 11:11 am
Hi,
Great plugin, thank you. One question. When I uncheck “Archives” box, and I access the hidden category directly, I get 404 error. It seems it does not fully hide a category if the posts in it are visible in archives.
Is this a bug?
Thank you. Shane.
January 1st, 2007 at 7:35 pm
Hi thank you for the plugin. Works so easy it was a snap to plug it right in. :)
January 9th, 2007 at 4:24 pm
This plug-in works great, thanks!
January 14th, 2007 at 7:34 am
I installed the plugin, however I keep getting this message
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ front=1, list=1, search=1, feed=1, archives=1, user_level=0′ at line 1]
REPLACE INTO wp_cat_visibility SET cat_ID=, front=1, list=1, search=1, feed=1, archives=1, user_level=0
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 1′ at line 1]
SELECT * FROM wp_cat_visibility WHERE cat_ID= LIMIT 1
and what does mean??
January 15th, 2007 at 4:26 am
Hey, I really like your plugin, but it conflicts with Sideblog Plugin v3.0. (I left a comment on the page for that plugin too.) I’m currently have yours deactivated, but if you want the error message I was getting or anything, let me know.
January 20th, 2007 at 6:39 am
Nice, I’ve tried several ways to accomplish this, and your solution is the first one that works. Excellent.
A question, though, is there some way to remove the category from the post too? That is, if I assign a post to two categories, one of which has all options unchecked, the hidden category is still displayed on the post (like “Posted on Jan 3, 2006 in: VisualCat, HiddenCat”).
So perhaps there should be another option to check/uncheck, because there might be situations when you want to make a category completely invisible to visitors.
January 20th, 2007 at 12:32 pm
Shane,
Maybe it is a bug. I get a variety of reports regarding the “archive” setting. Some happy, some not.
Zhe,
Looks like you’re having problems with Keith McDuffee’s version, not ours.
fs,
Yes, there can be conflicts. Sorry, we’re happy to share what we’ve done but we can’t fix conflicts. I guess you’ll have to choose, or reprogram yourself.
Johan,
Multiple categories are a challenge in more ways than one. I’ve looked at this before, and, because of caching and the way hooks are designed in WordPress, I didn’t identify a clean way to filter this.
In my sites, I just leave out the call to the_category(), so NO category hooks are displayed.
A lame workaround, I know.
January 23rd, 2007 at 6:05 am
many thanks for the lean solution of a whole set of structural problems of my site.
January 23rd, 2007 at 10:51 am
Hey guys im not sure if your aware but there are some compatibility problems with Wordpress 2.1. Ive been using the category Visibility for the last couple of months and upgraded to wordpress 2.1 this morning. For some reason the sub catagories arent hidden, only the text is hidden from the page. Take a look at my page www.graemechidgey.com and you can see on the footer and what i mean! its just a shame as the plugin is great!
cheers
Graeme
January 23rd, 2007 at 12:15 pm
^ Yup. Totally wicked plugin. Totally craptastic with WordPress 2.1. We’re really hoping you this plugin comes back to life for “Ella” because it rules!!!
January 23rd, 2007 at 12:38 pm
[…] Update 2: Not only does this version of Category Visibility work, it actually handles the number of posts on the front page better. We appear to have made it through a major upgrade without a loss in functionality! […]
January 23rd, 2007 at 5:08 pm
Also longing for an 2.1 compatible version.
January 24th, 2007 at 3:43 am
We’re going to test the beta as soon as possible but there’s an issue right now with trying to rollback to 2.0.7 from 2.1. Almost as if you “can’t” go back if you upgrade. I’m sure that’s not the case and something is just being overlooked.
Thanks for the fast response. Be back later to let you know how it goes…
January 24th, 2007 at 3:51 am
As said - at least for me that newest beta feaked the Manage page out. Only shows:
Catchable fatal error: Object of class wpdb could not be converted to string in /home/snfskane/public_html/wp-content/plugins/category_vis-rh.php
January 24th, 2007 at 5:11 am
Your archive of catvis 2.1b2 appears to contain v1.1b1 (beta 1), which unfortunately causes an SQL error on WP 2.1. Is this the correct file?
January 24th, 2007 at 8:02 am
Still working on the 2.1 version… thanks for the feedback.
January 24th, 2007 at 8:31 pm
I still (1.1.b3 [beta 3]
) get warningmessages when I enter manage in the admin area:
Catchable fatal error: Object of class wpdb could not be converted to string in /home/mypage/public_html/wp-content/plugins/category_vis-rh.php on line 242
And that line is following
$cats=$wpdb.’post2cat’;
January 25th, 2007 at 1:02 am
(beta3) On 2.1, it’s blocking the category listing on the sidebar, but in themes that also list the number of posts within that category, it still lists the number, although it does also omit the link. This may very well be somthing I just need to change in the theme.
Unfortunately, it also hides the category in the admin section: in the drop-down box for identifying the parent category of a new category (when it’s set to hide front, list and feed). Here it works too well.
That averages out to working, right? ;)
It’s definitely progressing. Thank you for your work. I look forward to the fruits of your labor.
January 25th, 2007 at 3:52 am
I was using Gudlyf version until upgrading WordPress to 2.1 this morning, database errors appeared. Have installed your plugin with no errors but I’ve some categories checked as not appearing on front page but it isn’t working, for example my “chorradas” one.
Suggestions?
Thank you for your work!
January 25th, 2007 at 5:26 am
The “Object of class wpdb could not be converted to string” error can be easily fixed by replacing $wpdb in that line with $wpdb->prefix
January 25th, 2007 at 8:45 am
lausse,
I had you try running it with that line commented out (it’s no longer needed)… and it worked, so I’ll post that version as beta 4.
thinker,
I’ll try to reproduce the category list thing. Can you verify what function your theme calls to produce the list?
With beta 3 I changed the method used to detect admin pages… it should now be returning an unchanged where clause, but in beta 4 I’ll try a slightly different approach.
Tapanez,
I looked at your website and the “chorradas” category was appearing in the sidebar, but did not seem to be showing up on the front page. To stop that uncheck chorradas for “List.” “List” applies to the sidebar type lists of categories. (So I don’t think that’s a plugin error.)
Michael Hinz,
You are exactly right, though it’s an unneeded line, removed in beta 4.
All,
You may have noticed that the new version is handling posts which are posted in multiple categories better… if ANY category is marked visible, the post appears. (Before it picked the first category mySql found.)
The logic here is that if you put it in a category that is visible, you aren’t wanting to hide it.
I’m uploading beta 4 for testing… although it has only a few adjustments, removing the unneeded line and another approach to admin panel tests. I really appreciate your feedback! Thanks!
January 25th, 2007 at 12:00 pm
Hi,
the problem with listing the number of posts without the category shown in WP 2.1.
Default theme uses:
wp_list_categories('show_count=1&title_li=Categories');This produces:
<a href="http://link/to/category" title="View all posts filed under category" rel="nofollow"></a> (1)There is indeed no text between the <a>-tags.</a>
The catecory is not visible, the count is.
Older themes use
wp_list_cats('sort_column=name&optioncount=1&hierarchical=0');which produces the same output.
Best Regards and thanks for this plugin,
André
January 25th, 2007 at 12:37 pm
Hello ive downloaded beta 4, the children is still not hidden, does anyone know if there is a way to do a CSS hack as a temporary measure to hide children catagories? apparently there are some issues with wp_list_categories, on the Wordpress forums some say this will be sorted out in the next version.
Graeme
January 25th, 2007 at 2:06 pm
Hello
i install youy plugin in last version wordpress
after activation it say this error in home page:
Catchable fatal error: Object of class wpdbcould not be converted to string in
/home/lover/public_html/wp-content/plugins/category_vis-rh.php
on line 212
Please tell me what is my problem & how can i fix this problem
thank you
January 25th, 2007 at 3:46 pm
Hey ive kind of found a way to remove the un-selected Children catagories. In your Css paste
}
.children {
display: none
}
and this will remove the Children blank subcatagories. This will not remove the un-selected parent catagories though. Thanks for the update Rich!
Cheers
January 25th, 2007 at 4:34 pm
wow, that was fast :) .
Works perfectly. Thanks again.
January 25th, 2007 at 8:04 pm
@love
I had the same error.
I took at a look at the code and noticed these 2 lines around line 242:
//$cats=$table_prefix.'post2cat';$cats=$wpdb.'post2cat';
If you swap the comment to this:
$cats=$table_prefix.'post2cat';//$cats=$wpdb.'post2cat';
it works!
January 25th, 2007 at 8:22 pm
André,
Thanks to you, your clue put me onto it.
Graeme,
I think the children issue is a WordPress issue, not catvis. Check here: http://ericulous.com/?p=93
I use Fold Category List plugin, and it seems to work as advertised.
love,
Try the beta version.
January 25th, 2007 at 10:56 pm
Other stuff works great now (woohoo! thanks)
I use the stock template for admin files…
Line 38 of wp_admin/edit-category-form.php calls the dropdown for choosing the category parent:
category_parent . ‘&hierarchical=1&show_option_none=’ . __(’None’)); ?>
Hope this helps. I certainly wouldn’t make it a priority as I doubt I’ll be using children of hidden categories, but the additional blank line jumped out at me and I considered how awkward it would be to want to set a child of one hidden category if you had more than one blank line to choose from.
I am impressed by your speedy work. Thanks again.
January 26th, 2007 at 6:52 pm
This is a very nice plugin, but it left the bullet and an empty place where the category would have shown.
January 27th, 2007 at 9:05 am
I having the same problem as Russ Adams. Is there a fix for that issue?
January 27th, 2007 at 11:10 am
Russ Adams, and Dating Sage,
In order to help, I need more info…
Are you using the latest beta?
Are you talking sidebar? What function is getting called in your sidebar?
What version of WordPress are you using?
January 27th, 2007 at 4:24 pm
I’m having the Same issue as dating sage and russ adams. I’m using the latest beta (5) with Wordpress 2.1. Everything else works perfectly thus far, but I need the category listing.
January 27th, 2007 at 7:52 pm
When I need it, I found you! Thanks!
January 28th, 2007 at 4:21 am
Rich, I am using the newest version of WP.
I love the Cat Visibility Plugin and it works swimmingly with all other plugins in WP 2.05,6 and 7.
However in 2.1 I get this sql error.
“WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(SELECT post_id FROM wp_post2cat LEFT JOIN wp_catt_visibili]
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND category_id IN (6, 4, 7, 8) AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’)) AND ID = ANY (SELECT post_id FROM wp_post2cat LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) WHERE ((wp_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR wp_catt_visibility.catt_ID IS NULL)) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 7″
I am uncertain what this means (still learning Dbases.)
January 28th, 2007 at 11:22 am
I am using beta 5. I am talking about the side bar. I am not sure how to tell which function is getting called. You can view the site by clicking on my name. I am running 2.1.
January 28th, 2007 at 12:53 pm
Since WP 2.1 the method cv_get_posts(’numberposts=5′) keeps listing pages as well??
Is there a way to prevent this?
Thank you…
January 29th, 2007 at 4:09 am
I just installed beta 5 on a new site running WP 2.1
I think it is working fine, I just want to check on a behavior - if I am logged in as the admin, am I supposed to still see the chosen category on the front page? I thought that the plugin was not working at all until I checked the site on a different browser (on which I was not logged in) and all of the posts in the chosen category were NOT visible. When I am logged in, they ARE visible. Is this the correct behavior?
January 29th, 2007 at 10:30 am
beta5 works well except the posts still show up on the home page of my blog. I’m not sure if that is on purpose but I was expecting them to be hidden.
thanks!
January 29th, 2007 at 11:29 am
Hi, i´m not sure, but i think i found a bug: i have a category-list wiht 3 level. with your plugin, the list has a failing: after level 3 is level 1 list in level 2 and not in level 1. understand you? try it with
list is ok without your plugin. but activte i your plugin, list has a failing.
can you fix it?
thank´s for your work!
markus (sorry for my terrible english!)
January 29th, 2007 at 1:16 pm
I managed to patch the issue with the appearing pages on cv_get_posts()
@line 479 I added “AND post_type=’post’ ”
to the SQL…
Maybe you can fix it or provide a switch. Afaik the original get_posts() does NOT bring up pages…
January 29th, 2007 at 3:09 pm
I tried out your plugin and it’s great! Beta5 and it runs fine on my 2.1 WP install.
One little glitch, can’t really blame you for it - after setting up the permissions, I went and changed a few category names and descriptions. I had to change/re-save all the permissions in your plugin for it to “see” the new categories, despite the status being listed correctly on your plugin page.
E-Mail me for details. =)
January 29th, 2007 at 4:58 pm
Oh hey just found another bug (may be related to the one listed previous) - If I’m in the admin panel, and I hit the “view site” button and it takes me back to the main page with a clean URL
thedailyblitz.org/
My categories posted as “not visible on the front page” are indeed visible. If I hit refresh they all go away. Any idea what’s causing that?
January 29th, 2007 at 11:29 pm
It’s not often you see this level of control in a plugin. That’s awesome. Great job.
I’m using the plugin for the first time with WP 2.1 and beta5. As some others have mentioned (and I haven’t seen an answer but I could have missed it) I’m having the problem where Months/years are showing up in my archive listing that contain posts that are in categories that I have set to be hidden. Is there a work-around for this so that if there are only hidden posts in a given month then it won’t show the month name under the Archives heading?
Thanks!
January 30th, 2007 at 2:27 am
cat-vis is one of the best plugins and it’s really great that someone feels responsible for keeping it running :-) Thank you, Rich. I just upgraded our blog to WP 2.1 and installed the beta version of cat-vis. Hitting the “search”-button I received the same error msg Ayerst did. Did someone find already a solution? Unfortunately it’s not connected to the php version (we use 4.3.10-16). It would be great to get some help! Thank you!
January 30th, 2007 at 5:16 am
[…] that’s such a handy plugin. first i had a separate blog for my photos and now thanks to that… all in one. just tell it wich category you don’t want to see on the frontpage and off you go. make a separate link for the category. ready. easy. here is the link socialize […]
January 31st, 2007 at 7:03 pm
I’m getting the same message as Ayerst and ALV. Any ideas?
WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(SELECT post_id FROM wp_post2cat LEFT JOIN wp_catt_visibili]
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’)) AND ID = ANY (SELECT post_id FROM wp_post2cat LEFT JOIN wp_catt_visibility ON (wp_post2cat.category_id = wp_catt_visibility.catt_ID) WHERE ((wp_catt_visibility.front=1 AND wp_catt_visibility.cv_user_level<=10) OR post_status=’static’ OR wp_catt_visibility.catt_ID IS NULL)) ORDER BY post_date DESC LIMIT 0, 5
January 31st, 2007 at 7:50 pm
If I click my Edit page link whilst viewing the blog then save I get this error:
WordPress database error: [Unknown column ‘category_id’ in ‘where clause’]
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND category_id IN (8) AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’)) GROUP BY wp_posts.ID ORDER BY post_date DESC
This error then disappears as soon as i refresh the page.
Any ideas?
January 31st, 2007 at 10:42 pm
Works for me. Thanks for updating. :D
February 1st, 2007 at 1:41 pm
A wonderful plugin! Absolutely CRUCIAL if you’re trying to do anything at all complicated.
I’m more used to Drupal, so trying to get clever with Categories drove me up a wall for two days!
This should really be part of any base installation of Wordpress.
February 1st, 2007 at 5:57 pm
Hi, I have recently moved to WP 2.1 and downloaded your latest version of the plugin. Beside the fact that it does a great job for me, it creates one little problem! Posts are listed multiple times if they are assigned to multiple categories. 3 categories, 3 times… etc.
They are not multi-listed on the category template but in the single template and RSS feed!?!
I know that cat-vis creates this problem, since it does not exist when I deactivate the plugin.
Is anyone familiar with this?
February 3rd, 2007 at 7:19 am
I have the latest version of the plugin (2.1beta5) running on my development site which is here:
http://www.stippy.com/wp_dev/
The plugin is active, and is set not to show the “japan-language/english-word-of-the-day” sub category anywhere. But, as you can see, it is displayed on the front page of the site (about the 4th post down, Title is “E-WOTD: Cuckold”).
Any other info that I should provide? I love this plugin, but it is really not working in my site with wp2.1.
February 4th, 2007 at 2:35 am
I have a mysql server 4.0 running, so I get the error in query (like some other people commenting). I believe the subqueries where added to fix a problem with posts who have multiple categories. As it happens, the post I’m trying to hide doesn’t have double categories. Could you republish a version of your 2.1 compatible plugin with the old query?
February 7th, 2007 at 4:20 pm
When we will have an update of this plugin for Wordpress 2.1?<