Getting the thread_id from the load_class_view Event Listener

robdog

Well-known member
I am trying to get the pages current thread_id when viewing a thread on the page.

Is there an object available to me or a static function I can call to get the thread info? Similar to:
$visitorId = XenForo_Visitor::getUserId();

Thanks.
 
What do you want to do?

If you're in the view object, you can access $this->_params where you should find the thread data
 
$this is not available to me. I am extended the load_class_view with the class being XenForo_ViewPublic_Thread_View

I get an error when I try to access $this.

I basically just want to get the User Id and the Thread Id when someone views a thread.
 
and then?:p

why not use a available template hook or extend the controller?

haha. I am pretty sure I using the wrong event listener.

I was thinking about extending the controller, but I was hoping for a simple static function to get the thread_id of the current thread being viewed.

I will get back after it and see if I can figure this stuff out! Damn you Zend!
 
Sweet got this part figured out! Now need to run an event when a reply is posted. Would this be similar functionality?

Thanks again!

Maybe you can use the:

PHP:
public function actionAddReply()

in XenForo/ControllerPublic/Thread.php
 
Maybe you can use the:

PHP:
public function actionAddReply()

in XenForo/ControllerPublic/Thread.php

Yup, that will get called if I extend that function. Now just need to figure out the proper response return to not screw up the actual reply functionality. Again, trying to increment a value in the thread column when a reply happens.
 
Yup, that will get called if I extend that function. Now just need to figure out the proper response return to not screw up the actual reply functionality. Again, trying to increment a value in the thread column when a reply happens.

What exactly you want to do? Maybe we could help.
 
Thanks you 2 for your help btw. Here is what I am working on btw:
http://www.gatorenvy.com/email-campaign

Basically a page that auto updates so I can run a cron that auto creates a Mail Chimp campaign once a week to send to my subscribers. Will add more customizations to the campaign template at a later date, but this is good enough for now! :)
 
Top Bottom