AndyB
Well-known member
If there's a duplicate position (see position 21) in the xf_post table like this:

and in the thread_view there's a page number showing which doesn't actually exist, if that page number is clicked my add-on shows an error.
I was hoping the redirect portion of the PHP code would prevent the error but it does not.
This is the error message:

Line #139

How can I prevent this error message?
Thank you.

and in the thread_view there's a page number showing which doesn't actually exist, if that page number is clicked my add-on shows an error.
I was hoping the redirect portion of the PHP code would prevent the error but it does not.
PHP:
<?php
namespace Andy\Calendar\XF\Pub\Controller;
use XF\Mvc\ParameterBag;
class Thread extends XFCP_Thread
{
public function actionIndex(ParameterBag $params)
{
//########################################
// show calendar dates in thread_view
//########################################
// get thread
$thread = $this->assertViewableThread($params->thread_id, $this->getThreadViewExtraWith());
// check if redirect
if ($thread->discussion_type == 'redirect')
{
if (!$thread->Redirect)
{
return $this->noPermission();
}
return $this->redirectPermanently($this->request->convertToAbsoluteUri($thread->Redirect->target_url));
}
...
This is the error message:

Line #139

How can I prevent this error message?
Thank you.