Skip to:
Content
Pages
Categories
Search
Top
Bottom

prevent bump to top when new replies are submitted?


  • blah
    Member

    @crackpixels

    How can I prevent the topic not to shoot to the top whenever new replies are submitted?

Viewing 10 replies - 1 through 10 (of 10 total)

  • chrishajer
    Participant

    @chrishajer

    When do you get bumped to the top? After posting a reply, or when you go to view a topic, you always start at the top?

    Also, what version bbPress are you using?


    blah
    Member

    @crackpixels

    After posting a reply. I know it’s normal for the topic to be bumped to the top along w/ the “Freshness” but I would like the Freshness to be replaced by the exact date when topic was created and for it not to bump to the top when someone replies.

    I’m using the latest 1.0.1.


    Tom(dB)
    Participant

    @tomdebruin

    I do this on one of my forums (a classified forum that I didn’t want users ‘bumping’ on constantly.) Just add

    <?php
    if ($forum_id == 3) {
    $limit = bb_get_option('page_topics');
    $offset = ($page-1)*$limit;
    $forum_one_topics = $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE forum_id = $forum_id AND topic_status = 0 AND topic_sticky = 0 ORDER BY topic_id DESC LIMIT $limit OFFSET $offset");
    $forum_one_topic_posts = get_thread( $topic->topic_id);
    $topics = $forum_one_topics;
    }
    ?>

    to the top of the forum.php file in your template. Take out the if ($forum_id == 3) { and trailing } if you want to apply it to all your forums.

    To show topic creation date instead of freshness replace topic_time(); with get_topic_start_time(); in the forum.php, and front-page.php template files – though I haven’t tested that bit.


    chrishajer
    Participant

    @chrishajer

    Oh, you don’t mean you (the browser) gets bumped to the top but that the topic gets bumped because it has a new reply. Got it now. Will tomdebruin’s solution work for you?


    Gautam
    Member

    @gautam2011

    I think get_topic_start_time(); will not echo it. You need to put topic_start_time();


    blah
    Member

    @crackpixels

    tomdebruin – thanks for helping but unfortunately your solution didn’t work for me. my topics are still getting bumped to the top.

    gautam – thanks, your solution worked!

    now i just have this one problem left w/ the topic bumping thing and i’ll be set. any other ideas i should try?


    Tom(dB)
    Participant

    @tomdebruin

    This code won’t work on front-page.php but did you try it in forum.php? I’m running v1.0.1 and it’s working fine there.

    For the front page you need to find the SQL query that gets called and replace it with your own, and ORDER BY topic_id. Let me know how you get on. I’ll have a closer look tomorrow when I’m working from home.


    blah
    Member

    @crackpixels

    Tom,

    I need it to be working on front-page.php. Can you further elaborate on the instructions? I’m not quite sure I’m following.


    Gautam
    Member

    @gautam2011

    I think, for the front page, where all topics are shown, you should put this:

    <?php
    $limit = bb_get_option('page_topics');
    $offset = ($page-1)*$limit;
    $all_topics = $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE topic_status = 0 AND topic_sticky = 0 ORDER BY topic_id DESC LIMIT $limit OFFSET $offset");
    $all_topic_posts = get_thread( $topic->topic_id);
    $topics = $all_topics;
    ?>

    Haven’t tested it, but should work.


    blah
    Member

    @crackpixels

    It worked! Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.