Exit to the Blog You're on in b2evolution (Backoffice Hack)

Published by Andrew Hreschak in Web Development, b2evolution 0.9.x, PHP
Published on 08/15/05 @ 09:37:00 am using 263 words, and has 15652 views

The default behavior of the backoffice administration panel in a b2evolution blog is to take the user to the first blog on the system after posting a new article or editing an existing one, instead of taking the user to the blog in which their article was just posted. This hack causes the b2evolution admin panel to exit the user to the blog they were actually working in, which saves some clicking and confusion, especially when implemented by the admin with their bloggers in mind.

To implement this hack in b2evolution 0.9.x, open /admin/_menutop.php file and look for the followinf code:

<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>

Replace that section with this:

<a href="<?php echo $htsrv_url ?>/login.php?action=logout"><?php echo T_('Logout') ?></a>
&bull;

<?php
if( $blog == 0 ) {
$blog = $Settings->get('default_blog_ID');
$active_blogurl = get_bloginfo('blogurl');
$blog = 0;
} else {
$active_blogurl = get_bloginfo('blogurl');
} ?>

<a href="<?php echo $active_blogurl ?>"><?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 blogs') ?>" /></a><br />
</div>

If you are using translations and want them to work properly then don't change "Exit to blogs" to "Exit to Active blog."

Thedarksighed blog uses stub files and we haven't tested this with anything else so you might have problems with other blog access methods. Those not using stubfiles should consider doing so, as they help to create clean and user-friendly URLs for your readers.

Contemporaneous Auditory Narcotics:
or, What my speakers are currently pumping...
Ed Rush and Optical - Kerbcrawl / Capsule [VRS008]

Adding Time of Day Verbiage to Your b2evolution Blog

Published by Andrew Hreschak in Web Development, b2evolution 0.9.x, PHP
Published on 08/15/05 @ 09:19:00 am using 271 words, and has 21849 views

By default, in a b2evolution blog, as with pratically every other popular blog platform, when a post is published on the blog it is tagged with a time in hours and minutes which reflect when the blog post was published. Obviously I'm not telling you anything here that you don't already know. However, this default behavior can be altered to display a simple "time of day" verbiage rather than the precise time at which the article was published.

In other words, the code below will replace the "posted at: TIMESTAMP" with a timestamp verbiage in any b2evo skin which displays the post time in the normal fashion. For example, "posted: 9:27am" becomes "posted: early morning".

To implement this PHP code hack on your own b2evolution 0.9.x blog system, place this function in your /conf/_hacks.php file:

Read the full story