How can I hide a specific blog for visitors?
Paul Iliano - December 7, 2004 - 11:54
I want to set up a site on a specific theme with no other users except myself as administrator. I would like to keep 2 blogs:
-one public blog: a classic blog on the web site's theme
-one private blog: a place for personal notes-thoughts-insights, not fit for public consumption, which I don't want others to see
I guess I need to create a second user for the private blog as a user can't have 2 blogs?
How can I keep this second and private blog from being seen by visitors? Having no link is not enough, as anyone with Drupal knowledge could find it by just typing blog/2.
Many thanks in advance,
Paul Iliano

Use Taxonomy Access Module
There is a relatively new module called the Taxonomy Access Module you can get from http://drupal.org/project/releases/cvs that will let you do this.
Just create a category for your blog and restrict access to that category using the taxonomy access module.
Can you explain a bit?
I'm not sure I understand you right. Does it mean I have to tag each and every entry for the private blog with this category?
Yes
Yes. Currently, there is no way to automatically restrict access to a specific node type (blog in this case) written by a specific user. You have to assign each blog item to a taxonomy and restrict access to it.
Oh, to answer your other question, no you don't have to set up two separate blogs. You can have one blog. For the entries you want to restrict acces to, assign them to the private category.
Thanks
Thanks nysus, that's clear.
Can you have a look at my follow-up question to the original post about how to list these private blog entries?
Yes
Yes. Make a new vocabulary with two terms: "private" and "public" (or whatever fits your taste).
I'm doing it and it works fine. In order to clearly see what items are private I've added this little script to node.tpl.php (I'm using phptemplate):
<?php
if ($page == 0) {
$visibility = current(taxonomy_node_get_terms_by_vocabulary($node->nid, 2)); // Replace 2 with the number of your vocabulary
if ($visibility->name == "public") {
print("<h3 class='title public'><a href='$node_url/edit'>$title</a></h3>");
} else {
print("<h3 class='title private'>$title</h3>");
}
?>
Than use css to make either h3.public or h3.private stand out.
Not necessary
Just a note to Paul: the taxonomy access module doesn't require you to alter the code like this. This is a separate solution being offered.
Can you elaborate?
Thanks Tommy.
Where do I find the file "node.tpl.php"? I can't seem to find it on my site.
Secondly, could you have a look at my follow-up comment to the opening question, where I explain that I would like to see both a list of mixed public-private entries, and one of pure private entries. Thanks.
enhanced script
Mr. Sundstrom's script was very helpful to me. However, it doesn't handle the case where a node is tagged with multiple categories. Also, it took me a while to figure out how to modify the style appropriately, so I figured I'd post that as well.
Modify node.tpl.php, in the appropriate theme directory, replacing the line that contains "if ($page == 0)... " with this:
<?php$vocab = 1 // Replace with your vocabulary number
$secret_term = "private" // replace with the term you want to mark as secret
if ($page == 0) {
$vterms = taxonomy_node_get_terms_by_vocabulary($node->nid, $vocab);
$private = 0;
foreach( $vterms as $key => $term ) {
if ($term->name == $secret_term) {
$private = 1;
break;
}
}
if( $private == 1 ) {
print("<h2 class='title private'><a href='$node_url'>$title</a></h3>");
} else {
print("<h2 class='title public'><a href='$node_url'>$title</a></h3>");
}
}
?>
And modify style.css in that same directory. Note that the change below is for <a>, not <h2>. Also, it needs to go below other relevant styles, like at the end of the .css file
.private a {color: #f55;
}
What I forgot is: How can I see lists of private entries?
Thanks very much to nysus and Tommy Sundstrom for their solutions!
But only now do I realize that of course I need a way to see my private entries. Dohhh
Suppose I use 1 blog and have entries tagged to the terms "public" and "private". What I would like to see is 2 lists just for myself:
-a list showing both public and private entries so I can see my train of thought (public entries will often be a synthesis of x private entries)
-a list of only private entries
How can I pull this off? Thanks.
It's easy
If you are logged in, and your role has the right permissions, you would be able to see everything.
Miguel Duarte
Webmaster of: Lisbon Guide & Love Poems
Here's how
OK, so you have one blog with two different kinds of entries: those you have classified as private and those you have classified as public. We will assume you have given yourself permission to see both kinds of entries. We will assume you have denied all other users permission to view the private entriesa and can only see the public. This also assumes you are using the taxonomy_access module.
When you view your blog, you will see both types of entries. When others view your blog, they will see only the public entries.
If you just want to see your private blog entries, simply visit the taxonomy term that correlates to your private entries. Only your private entries will show. Use /taxonomy/term/x in the url where "x" is the term id of your private taxonomy.
A final question...
Thanks, I understand.
One final question though: when visitors look at public blog entries, will they see that they belong to a category called "public", i.e. will the category "public" show up as a link next to the other categories an entry belongs to?
Only if you want it to
Don't put your public blog items in any category and they won't see anthing.
Of course...
Of course, I should have thought of that myself.
Thanks again for all your kind help. I now have a clear solution for hiding private blog entries.
Hiding uploaded files in users' blogs/articles?
Is it possible to have:
- users with their own blogs (stories/articles etc but blogs are probably the best here), and
- their uploaded files to be seen only by administrator and user who has uploaded them
General problem is to have authenticated users sending their home programming work to organization site via uploaded files which should not be visible/available for other users but site admin should see them all.
Thanks for any help. ZIP files with passwords, defining separate group for each user etc should not be a solution ... If it's possible to do that with taxonomy.access, sitesurvey, workflow or other available modules and one has done it please post here too.
Second that wish. Is this possible with 4.6?
This is among the several important security issues I assume is not supported yet. Does 4.7 make any difference in this respect?
Could this be solved by
Could this be solved by simply copying the blog module to a second module, let's call it journal, so that you have 2 blog modules of different types? You could then set permissions no the journal module as you wished with high security and then open the blog up to provide all the access you wanted. Maybe I'm missing something though (besides the fact that this discussion is really old).
an effective hack, though not recommended
This solution seems like an effective hack, though of course making the second module is a bit more than just copying the .module file. You'd need to change the name of every function in the file as well. And perhaps not "journal", as that's already the name of a module. ;-)
But I'd still recommend achieving the goal with the configuration of existing modules, rather than the creation of an entire separate module that merely renames a real one.