Topic: Sticky Topics

Hi guys,

Are there any plans for creating a sticky topic in NB, similar to the one's found in PunBB? Currently I achieve this by setting the post date to the furthest date, example Dec 20xx, but I would prefer something like a "sticky" option. Is there a hack or mod available or is this maybe a feature that is coming soon?

Regards,
Nino

"Nibbleblog is amongst the great - "one small step for man, one giant leap for mankind"

Re: Sticky Topics

Hello Nino,
in this moment this feature is not implemented, but I will considerate.

Regards

Re: Sticky Topics

As a blog, I think this would probably be described as a "promoted" post, that, for example, you might want to have your front page display.
The you could have some kind of insert for promoted posts, that would go above your regular posts, or on the front page for a news/magazine type theme.

Re: Sticky Topics

I couldn't find anything to suggest this feature has been implemented, so I hacked a solution together. It's crude, but it works (for me). I've posted instructions as a sticky post at my site: http://jharps.co.uk

It requires the creation of a category named Sticky, and the creation of an init.bit file to go in the theme folder.

init.bit

<?php
/**************************************************/
/*   Update the published date of 'Sticky' Posts  */
/**************************************************/

// Puts 'Sticky' Category posts at top of Home page.
// Simply updates the 'published' date of 'Sticky'
// posts to time blog is accessed.

foreach( $categories as $category )
{
    if($category['name'] == 'Sticky'){
        $sticky_cat_id = $category['id'];
        break;
    }
}
if(isset($sticky_cat_id)){
    $items = $_DB_POST->get_list_by_category(array('id_cat'=>$sticky_cat_id,'page'=>0,'amount'=>10));

    foreach( $items as $item )
    {
        $item[] = 'unixstamp';
        $item['unixstamp'] = Date::unixstamp();
        if(is_array($item['content']))
        $item['content'] = $item['content'][0];
        $_DB_POST->set($item);
    }
}

?>

There's a download link at my site if you can't be bothered creating the file yourself.

Re: Sticky Topics

I've switched to using a 'sticky' tag rather than a category. It's more versatile. Same procedure as in my previous post except there is no need to create a Sticky category, of course. Here's the revised init.bit (or you can download it from my website: http://jharps.co.uk)

<?php
/**************************************************/
/*   Update the published date of 'Sticky' Post'  */
/**************************************************/

// Puts 'sticky' tagged posts at top of Home page.
// Simply updates the 'published' date of 'Sticky'
// posts to time blog is accessed.

global $_DB_TAGS;

// Get post_ids tagged with 'sticky''
$pids = $_DB_TAGS->get_all_posts(array('name'=>'sticky'));

// Update published date of sticky posts
if (is_array($pids)) {
    $ix = 0;
    foreach($pids as $pid) {
        $item = $_DB_POST->get(array('id'=>$pid));
        $item[] = 'unixstamp';
        $item['unixstamp'] = Date::unixstamp();
        if(is_array($item['content']))
        $item['content'] = $item['content'][0];
        $_DB_POST->set($item);
        $ix++;
    }
}

?>