- b2evolution CMS Support Forums
- b2evolution Support
- Plugins & Extensions
- How to hide blogs with skins, only to be seen for registered
1 mikel Mar 31, 2005 17:41
How to hide blogs with skins, only to be seen for registered users.
So many people cried for hidden blogs, so I want to show my way, I know there would be better (argghh). Even in better english. (Sorry for that)
Very dirty, very tricky, but it works.
I wanted to have a hidden blog (only for registered users) in a multiuser- Blog for chatting and talking off topic in more inside-discussing posts, we want to write another Lit-Anthologie there (you know!?).
So I have to hide Blog 1 (for there is ANYTHING posted ) and blog (9 in my case).
Let's do it!
Step 1:
edit
_main.php (in EVERY skin on your blog)
Add this directly after the <body> - Tag
(take the blog Id's from YOUR ?hidden blog?, see blogs in the backoffice)
<? //get blog-id
$this_blog=$Blog->dget( 'ID');
if ($this_blog==9 and $user_ID < 1)
{
return false;
//nothing happens when called ;-)
}
$this_blog=$Blog->dget( 'ID');
if ($this_blog==1 and $user_ID < 1)
{
return false;
//nothing happens when called ;-)
}
// add more blogs if you want
?>
search for
<?php
/**
* --------------------------- BLOG LIST INCLUDED HERE -----------------------------
*/
require( dirname(__FILE__).'/_bloglist.php' );
// ----------------------------- END OF BLOG LIST ---------------------------- ?>
replace it with:
<?php
/**
* --------------------------- BLOG LIST INCLUDED HERE -----------------------------
*/
if ($user_ID > 0) //Bloglist with hidden Blogs only for registered Users
{
require( dirname(__FILE__).'/_bloglist.php' );
}
else
{
require( dirname(__FILE__).'/_bloglist_public.php' );
}
// ----------------------------- END OF BLOG LIST ---------------------------- ?>
Step 2
copy _bloglist.php (INSIDE EVERY skin-folder)
save it as _bloglist_public.php
search (in the new file _bloglist_public.php)
require get_path('skins').'/_bloglist.php';
replace it with:
require get_path('skins').'/_bloglist_public.php'
Step 3
copy _bloglist.php (in the (main) skin-folder)
save it as _bloglist_public.php
search (in the new file _bloglist_public.php)
if( !blog_list_iteminfo( 'in_bloglist', false ) )
{ // don't show
continue;
}
add here: (use YOUR blog_Id's from Step 1)
if ($curr_blog_ID==9)
{
continue;
}
if ($curr_blog_ID==1)
{
continue;
}
//ad more blogs if you want
thats it.
Only registered users are able to see blog1=All and your hidden blogs.
For a better overview of posts I copied my main skin to a blogall-skin
and in the _main.php
I deleted
<?php $Item->content(); ?>
So I have only Links to Posts ;-)
If you want to see the site (without the hidden blogs of cause, haha)
All the gods of php and the pure B2evo, please don't beat me ;-)......
hey, I just wanted to thank you for posting this thread. Although I didn't get some of it to work, I was able to use what you gave as a base to help me out.
and I finally got "$user_ID" (I've been wondering for so long how to call a user's ID...).