2 balupton Sep 26, 2006 09:52
![](http://www.gravatar.com/avatar/caaf3aab5165e6179cb0fafcbd63eb47?size=80&default=https%3A%2F%2Fforums.b2evolution.net%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1659823855)
You could do so with a few SQL queries.
Basically, you need to change the blog_ID in the evo_blogs table and simultaneously all the tables that refer to it.
See http://doc.b2evolution.net/DB_schema/ for the DB schema - there are 6 foreign keys (FK) for b2evo 1.8 (e.g. from T_coll_settings).
If you really want it, you should be done with 7 UPDATE queries - but seriously, that's not a very good way to "hide" it.. you probably want to setup authentication through HTTP in your .htaccess or something alike.
Cool, the hack sounds like it'd be perfect for my purposes... thanks so much! :)
Authentication is a little more than I need - I don't mind the world at large finding this blog, I'd just rather people I actually know weren't on it. :p The particular person who found it is not very computer saavy, so just changing the url should hopefully suffice.
Possibly a dumb question but... where do I specify the urlname and shortname for a blog?
Backoffice (admin) -> Blogs -> Click your blog, and will be in the first tab.
They will look like; my_blog_name or similiar.
Ahh, duh. :oops:
So.... is the "Full Name" tag the "urlname" then?
Url name is "URL blog name:" under "Blog URL parameters"
Hrmm my method would stop working as soon as the user clicks a link, as blog=urlname would switch back to blog=blogid, Blueyed can you provide a fix for this, i tried just overwriting the blog param before the skin gets displayed but i could not get that to work...
balupton, $blog probably got overwritten/re-typed to integer at the beginning of _blog_main.inc.php.
yeh i tried adding it before the event BeforeBlogDisplay, but yeh i don't think changing $blog would be a good idea anyway, so i think maybe add a new param called blogshortname that gets memorized, so before the die, we check if that is correct?
But i can never seem to get any params to memorize....
I'd go for updating the blog_ID in the DB tables.
(There's an option of param() to memorize them, but they only get re-used with regenerate_url())
Ok got it working, So apply the hack i mentioned earlier, and use the following instead.
// ==========================================================================================================
// START OF BALUPTON's URLNAME AND SHORTNAME HACK
// Check if a specific blog has been requested in the URL:
param( 'blog', 'string', '', true );
// If $blog is a number
if( is_numeric($blog) ) {
// Make $blog's type a number
settype($blog,'integer');
if ( $blog == 2 && ( !isset($_SERVER['HTTP_REFERER']) || !strstr($_SERVER['HTTP_REFERER'],$baseurl) ) )
die('Hidden blog');
} else {
// Check for urlname, if not check for shortname, if not use the default value
$blog = ($temp = $BlogCache->get_by_urlname($blog, false)) ? $temp->ID :
(($temp = $BlogCache->get_by_shortname($blog, false)) ? $temp->ID : '');
unset($temp);
}
// END OF BALUPTON's URLNAME AND SHORTNAME HACK
// ==========================================================================================================
And change the $blog == 2 part to whatever the blog ID is, and it will all be good.
1/ create a new blog
2/ enable "moving chapters" (conf/admin.php or advanced.php)
3/ hit admin>[current blog] > categories and move them (complete with posts) to new blog
¥
I think the above needs a step 2.5 (or 1.5). In the same file - which is conf/admin.php - set $allow_cross_posting to 3.
So
$allow_cross_posting = 1;
/**
* Moving chapters between blogs?
*
* Special value: NULL and we won't even talk about moving
*
* @global bool|NULL $allow_moving_chapters
*/
$allow_moving_chapters = false;
Becomes
$allow_cross_posting = 3;
/**
* Moving chapters between blogs?
*
* Special value: NULL and we won't even talk about moving
*
* @global bool|NULL $allow_moving_chapters
*/
$allow_moving_chapters = true;
After moving the chapters (categories) you set these values back and you're done.
Oh and move your sub-categories first! In a recent version (and I don't know about the most recent release) if you moved a main category the sub-categories would get abandoned in no-blog land. They didn't get deleted, but they didn't follow the parent category either.
EdB wrote:
Oh and move your sub-categories first! In a recent version (and I don't know about the most recent release) if you moved a main category the sub-categories would get abandoned in no-blog land. They didn't get deleted, but they didn't follow the parent category either.
I forgot all about that bug :p I thought I'd cured it in cvs, but it looks like it never made it into either of the last couple of versions (although it is in version 2.0 .... so far) :cookie:
¥
Doing this manually would take forever, doing it automaticly has not been added.
What you could do instead... Is apply the hack [url=http://forums.b2evolution.net//viewtopic.php?t=8089]here[/url]. Then make it so it dies if they tried to access the blog you wanted via integer reference.
So instead of the lat part in the above hack, apply the following;
That way people can only access the hidden blog by knowing it's shortname or urlname.
Btw you need a 1.8 release for this.
Edit: Whoops forgot to add the link to the hack...