Recent Topics

"Exit to Active Blog" for stub users

Started by on Jul 21, 2004 – Contents updated: Jul 21, 2004

Jul 21, 2004 02:02    

This only works for people who use only stubs to access their blogs.

In /admin/_menutop.php find:

<div id="headfunctions">
	<?php echo T_('Style:') ?>
	<a href="#" onclick="setActiveStyleSheet('Variation'); return false;" title="Variation (Default)">V</a>&middot;<a href="#" onclick="setActiveStyleSheet('Desert'); return false;" title="Desert">D</a>&middot;<a href="#" onclick="setActiveStyleSheet('Legacy'); return false;" title="Legacy">L</a><?php if( is_file( dirname(__FILE__).'/custom.css' ) ) { ?>&middot;<a href="#" onclick="setActiveStyleSheet('Custom'); return false;" title="Custom">C</a><?php } ?>
	&bull;
	<a href="<?php echo $htsrv_url ?>/login.php?action=logout"><?php echo T_('Logout') ?></a>
	&bull;
	<a href="<?php echo $baseurl ?>"><?php echo T_('Exit to blogs') ?> <img src="img/close.gif" width="14" height="14" class="top" alt="" title="<?php echo T_('Exit to blogs') ?>" /></a><br />
</div>

and change it to:

<?php 
// get the stub name for the active blog, if there is one
if( $blog != '' )
	{
	$blogstub = getblogstub( $blog );
	$blogstub = $baseurl."/".$blogstub;
	} else {
	// if there is no active blog then pick the default blog
	$blogstub = getblogstub( 2 );
	$blogstub = $baseurl."/".$blogstub;
	}
?>
<div id="headfunctions">
	<?php echo T_('Style:') ?>
	<a href="#" onclick="setActiveStyleSheet('Variation'); return false;" title="Variation (Default)">V</a>&middot;<a href="#" onclick="setActiveStyleSheet('Desert'); return false;" title="Desert">D</a>&middot;<a href="#" onclick="setActiveStyleSheet('Legacy'); return false;" title="Legacy">L</a><?php if( is_file( dirname(__FILE__).'/custom.css' ) ) { ?>&middot;<a href="#" onclick="setActiveStyleSheet('Custom'); return false;" title="Custom">C</a><?php } ?>
	&bull;
	<a href="<?php echo $htsrv_url ?>/login.php?action=logout"><?php echo T_('Logout') ?></a>
	&bull;
	<a href="<?php echo $blogstub ?>"><?php echo T_('Exit to Active Blog') ?> <img src="img/close.gif" width="14" height="14" class="top" alt="" title="<?php echo T_('Exit to Active Blog') ?>" /></a><br />
</div>

The function "getblogstub()" looks like this:


function getblogstub( $whichstub )
	{
	global $DB, $tableblogs;
	// get the blog stub name based on blog ID
	$query = "SELECT blog_stub FROM $tableblogs WHERE blog_ID = $whichstub";
	$blogstub = $DB->get_var( $query );
	return $blogstub;
	}

If this was a good hack it would look at blog access method and generate an appropriate link, but it's not. :roll:

May 05, 2005 09:55

I've tried it, but when I click on the admin link on the active blog it takes me to /admin/b2edit.php?blog=5 which just displays a blank page with only the header section?! no body content.

Any suggestions?

PS. I am only using stubs to access all my blogs.

Nov 09, 2006 04:42

Does anyone know how to do this in 1.8.2, without using stubs. I plan on going to stubs in the future just haven't gotten around to doing it. I was able to do it in v.9.1 without stub I just can't figure out how to do this in 1.8.2 version.

Nov 10, 2006 22:04

Check the hack i did, its here somewhere, called something slightly different though.


Form is loading...

Photo gallery software – This forum is powered by b2evolution CMS, a complete engine for your website.