MyBB Community Forums

Full Version: is there a way to link to the most recent page of a thread without linking a pid?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
basically, i want clicking on a thread to bring you to the most recent page of the thread but still keeping you at the top of the page, so without linking to a specific post.

(I know this sounds weird but I have my reasons.)
&action=lastpost
Are you serious?
(2012-12-02, 05:35 AM)brad-t Wrote: [ -> ]Are you serious?

I hope he isn't.

If you append '#top' to a URL it will leave the page at the top and not scroll down even if there is a specific post in the link.
Hmm. That's pretty hacky. I'd like to know if there's another solution. Thank you, though.
Open showthread.php, find:
	header("Location: ".htmlspecialchars_decode(get_post_link($pid, $tid))."#pid{$pid}");

And replace with:
	if(isset($mybb->input['short']) && $mybb->input['short'] == 1)
	{
		header("Location: ".htmlspecialchars_decode(get_post_link($pid, $tid)));
	}
	else
	{
		header("Location: ".htmlspecialchars_decode(get_post_link($pid, $tid))."#pid{$pid}");
	}

Now use:
&action=lastpost&short=1

Or (using templates conditionals, showthread*):
<?=get_thread_link($thread['tid'], 0, 'lastpost&amp;short=1')?>

Think it should work n.n
I only want to do it for a specific forum, so that's out of the question. Thanks for your effort. Maybe #top is the best solution.
(2012-12-02, 04:25 PM)brad-t Wrote: [ -> ]I only want to do it for a specific forum, so that's out of the question. Thanks for your effort. Maybe #top is the best solution.

Sorry, I just don't know another way.
Haha, if it works its good Wink
Omar's solution seems fine to me.

If you only want to use it for a specific forum, then only use the &short=1 parameter for the desired forum link.
Pages: 1 2