Skip to:
Content
Pages
Categories
Search
Top
Bottom

Inserting ID’s to every posts in a thread. Like 1,2,3,4 …


  • injua
    Participant

    @injua

    Something got wrong when I tried to post this, here it is again.

    I would like to see post in every thread with a visible ID like: 1, 2, 3, 4 etc. starting from the top. Many members like to reference a post by simply writing “To #3 bla bla….” and this would be the third post in the thread.

    I tried to simply do math in topics.php
    Like:
    `

    <li id="post-” class=””>

    <a href="#post-” title=””>#

    `

    The function where the ID comes from would be:
    ` function mip_startnum() {
    global $topic_template;
    $start_num = intval( ( $topic_template->pag_page – 1 ) * $topic_template->pag_num ) + 1;
    $from_num = bp_core_number_format( $start_num );
    return $from_num;
    }`

    You would think everything would be fine, wouldn’t ya? :) But if a member deletes his or her own post all the other posts gets bumbed and the logic is screwed up. So I’m thinking the way might be to somehow insert a ID into every post and then output them with the content. This way it wouldn’t matter if someone deleted a single post in a thread since the ID’s are all hard coded into the individual posts.

    But I’m not that good at coding and at lost to where to begin, help anyone?

  • The topic ‘Inserting ID’s to every posts in a thread. Like 1,2,3,4 …’ is closed to new replies.
Skip to toolbar