Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Matthew Rowland

    (@conundrum89)

    Hi Robkk,

    You can use
    remove_action( 'bbp_theme_after_topic_title', 'gtf_get_unread_post_link' );
    to remove the default GTFUP link. Then you can use add_action( ) (with 'gtf_get_unread_post_link' as the second argument) somewhere else to add the button back in to a custom location.

    If you’d like to change the appearance of the button, you can use
    add_action( 'gtf_get_unread_post_link', 'my_function', 10, 3);
    Then simply define
    function my_function( $link, $topic_id, $last_read_id ) { }
    and whatever that function returns is what will be displayed for the button.

    Hope this helps!

    Thread Starter Robkk

    (@robkk)

    hey thanks for the support

    i placed this in my functions.php in my child theme

    remove_action( 'bbp_theme_after_topic_title', 'gtf_unread_post_link' );

    without the _get and it seemed to work

    and placed this in my loop-single-topic.php

    <?php echo gtf_get_unread_post_link( $topic_id ); ?>

    is this a correct way of doing all this??

    Thread Starter Robkk

    (@robkk)

    Then simply define
    function my_function( $link, $topic_id, $last_read_id ) { }

    so if i use $topic_id it would go to the unread topic (topic author post)
    would it show up on any unread topics??

    and i use $last_read_id if would just go to the last read post
    would this show up only on read topics? not all topics?

    what does $link do?

    and can i use them all ??

    Plugin Author Matthew Rowland

    (@conundrum89)

    Yes, the way you’ve changed the location of the button is perfectly valid ??

    For my_function( $link, $topic_id, $last_read_id ) – the arguments supplied are as follows.

    $link – the default link, as a string. If you simply want to change a little bit of the default link – eg. the text in it – you could take $link, do a str_replace() on it, and return the result. If you want to change a lot, then your best bet is to use regular expressions to get the URL part out of this string, and then use it in your own HTML and return that.

    $topic_id is just the same topic ID that was passed to gtf_get_unread_post_link() – it’s provided again in case you want to use it, but you definitely don’t have to.

    $last_read_id is the post that was calculated as the last post that the user read in that topic. Again, you don’t need to use it – it’s provided just in case you want to.

    In hindsight, a more useful thing to return would have been the post id of the first unread post – so that it’s easy for you to construct a whole new link using that ID. I’ll look into changing that for a future update.

    No matter what you do here, the link will only show up on topics with unread posts – because gtf_get_unread_post_link() will not call your function if there are no new posts in the topic.

    Thread Starter Robkk

    (@robkk)

    ok cool i was just checking

    and great!!! thanks for the explantion!!

    Plugin Author Matthew Rowland

    (@conundrum89)

    You’re very welcome, and thanks for the review!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘custom placement of gtfup link??’ is closed to new replies.