Skip to:
Content
Pages
Categories
Search
Top
Bottom

page navigation problem


  • sureshdrim
    Participant

    @sureshdrim

    Hello All.

    I want to add an anchor tag on top of each topic page called “reply to topic” on my forum which when clicked should go to #postform,if the person is logged in,else to login page,which is working good.But theres is problem when a topic has more than on page.For Ex-If it has one page its all right if I specify href=”#postform”

    ,But in case of two pages,href values should be

    href=”topic.php?id=<?php topic_id();?>&page=2#postform”

    can someone please tell me how to get this &page value at run time or what will be the href value in such case coz page value will keep on changing.

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

  • sureshdrim
    Participant

    @sureshdrim

    I also tried to get this value from post_form() function declared in bb-includes > functions.bb-templates.php

    But could not solve the problem.

    Please help.


    zaerl
    Participant

    @zaerl

    Curtesy of the ajaxed-quote plugin:

    function replay_link() {
    if ( !bb_is_topic() ) return false;

    global $page, $topic, $bb_post;

    if ( !$topic || !topic_is_open( $bb_post->topic_id ) || !bb_is_user_logged_in() || !bb_current_user_can('write_posts') )
    return false;

    $post_id = get_post_id();

    $add = topic_pages_add();
    $last_page = get_page_number( $topic->topic_posts + $add );

    if ( $page == $last_page ) return '#post_content';
    } else return get_topic_link( 0, $last_page ) ) . '#postform";
    }

    Not tested.


    sureshdrim
    Participant

    @sureshdrim

    Hello zaerl..

    There’s something wrong.I tried this code but not working as expected.


    kevinjohngallagher
    Member

    @kevinjohngallagher

    I tried this code but not working as expected.

    Could you tell us what it is and is not doing?

    We can not help you if you don’t tell us whats wrong :)


    zaerl
    Participant

    @zaerl

    Not tested.

    #post_content is #postform.


    sureshdrim
    Participant

    @sureshdrim

    Hello Zaerl..

    I think there’s still something missing in ur code.I came out with more simple code which is tested and working good. (not sure if its 100 % reliable)

    function reply_link() {

    global $topic;

    $add = topic_pages_add();

    $last_page = bb_get_page_number( ( isset( $topic->topic_posts ) ? $topic->topic_posts : 0 ) + $add );

    $h2 = esc_attr( get_topic_link( 0, $last_page ) . ‘#postform’ );

    echo $h2;

    }

    Hello kevinjohngallagher..

    Actually I was looking for href value of an anchor tag which I want to add below each post.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar