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

Getting the thread_id from the load_class_view Event Listener

robdog

Well-known member
#1
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.
 
R

ragtek

Guest
#2
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
 

robdog

Well-known member
#3
$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.
 

robdog

Well-known member
#6
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!
 

robdog

Well-known member
#11
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.
 

Fuhrmann

Well-known member
#12
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.
 

robdog

Well-known member
#15
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! :)