<?php
class Andy_SimilarThreads_Route_Prefix_SimilarThreads implements XenForo_Route_Interface
{
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
return $router->getRouteMatch('Andy_SimilarThreads_ControllerPublic_Forum', 'Index', $routePath);
}
}
?>
$visitor = XenForo_Visitor::getInstance();
$userId = $visitor['user_id'];
$params = $this->_getDb()->fetchOne("
SELECT params
FROM xf_session_activity
WHERE user_id = '$userId'
AND controller_action = 'CreateThread'
");
if ($params != '')
{
$pos1 = strpos($params,'node_id=');
if (is_numeric($pos1))
{
$currentNodeId = substr($params,8);
}
}
XenForo.ajax(
$('base').attr('href') + 'similarthreads/',
$form.serializeArray(),
function(ajaxData, textStatus)
...............
XenForo.ajax(
$title.data('checkUrl'),
{ title: $title.val() },
function(ajaxData, textStatus)
................
public function actionSimilarThreads()
{
$forumId = $this->_input->filterSingle('node_id', XenForo_Input::UINT);
$forumName = $this->_input->filterSingle('node_name', XenForo_Input::STRING);
$ftpHelper = $this->getHelper('ForumThreadPost');
$forum = $ftpHelper->assertForumValidAndViewable($forumId ? $forumId : $forumName);
$forumId = $forum['node_id'];
$title= $this->_input->filterSingle('title', XenForo_Input::STRING);
// your code goes here
}
Hi Andy,
If you want to extends XenForo_ControllerPublic_Forum, use another class because Andy_SimilarThreads_ControllerPublic_Forum was using for the route "similarthreads". But i don't think you need to create new route, just extending the XenForo_ControllerPublic_Forum and create new action. Here are my suggestions.
We use essential cookies to make this site work, and optional cookies to enhance your experience.