• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Add "?forum_id" to thread links

James

Well-known member
#2
You'd have to edit the route and add it as a parameter at build time. I can't give you an example right now because I'm mobile.
 

Jake Bunce

XenForo moderator
Staff member
#3
Need to extend this:

XenForo_Route_Prefix_Threads::buildLink

Thread records contain the node_id, though it might not be safe to assume the node_id is available. Might have to do an isset() check on that before adding it to the link.
 

Marcus

Well-known member
#4
I added $thread['myforumId'] = 5 to ControllerPublic_Thread::actionIndex and I can see this variable on XenForo_Route_Prefix_Threads::buildLink with $extraParams['test'] = var_dump($data);

Code:
array(35) {
["thread_id"]=> int(2)
["node_id"]=> int(2)
["title"]=> string(4) "testtitle"
  ....
["myforumId"]=> int(5)}
This adds the title to the url: $extraParams['test'] = $data['title']; But $extraParams['test2'] = $data['myforumId']; does not work. Do you have any idea why my variable is displayed in the dump:$data, but it does not work here? Thank you so much.