project blog

digital diary of diverse diversions

10 September 2005

B2Evolution Hack: Exit to Active Blog

Written by Yours Truly ( Contact the author of this post )
Published on September 10th, 2005 @ 06:41:28 pm, using 539 words, 16674 views

This hack allows you to avoid the annoyingness of exiting to the first blog/stub after creating or editing a post in a sub-blog. In short, it saves a mouse-click and a little confusion... This hack for the b2evolution 0.9.x admin interface only works for people who use stubfiles to access their b2evo blogs, and who have correctly configured their stubfiles in their server's .htaccess file.

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:

[Continued...]

<?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;
}

This should work for stubs, but will not work for blogs without stubs.

Contemporaneous Auditory Narcotics:
or, What my speakers are currently pumping...
Sham 69 - Borstal Breakout
Bookmark this Post
b2evolution, b2evo, blog, PHP, hack, stub, htaccess
scuttle co.mments Technorati del.icio.us digg SpyMy StumbleUpon backflip blinklist BlogMarks BlogMemes BuddyMarks Feed Me Links! FURL gravee Linkroll ma.gnolia netvouz Simpy Yahoo! My Web

Comments, Trackbacks, Pingbacks:

No Comments/Trackbacks/Pingbacks for this post yet...

This post has 124 feedbacks awaiting moderation...

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

project blog

A journal containing the assorted projects and diversions which occupy my interest, including such things as Photoshop graphic design and standards compliant web design, web development, advanced css layouts, photography and photo-manipulation... whatever...




Choose skin

  • Switch to the route_53 skin
  • Switch to the december skin
  • Switch to the lush skin
  • Switch to the candleglow skin
  • Switch to the vastitude skin
  • Switch to the viper_flats skin
  • Switch to the underground skin
  • Switch to the wheelz_blue skin
  • Switch to the ravehands skin
  • Switch to the sojourn skin
  • Switch to the tunnel_vision skin

Miscellany

XML Feeds

Users Currently Online

  • Guest Users: 76

The Extras

Contact the admin     Engine: b2evolution     Hosting: Hostgator.com
Content Copyright ©2004-2013 TheDarksighed. All Rights Reserved.