PDA

View Full Version : How do I get threadid from showpost?


vauge
09-01-2012, 09:43 PM
vB4.2

I'm creating a new plugin that needs the threadid of the thread the user is currently viewing.

I have read this article: https://vborg.vbsupport.ru/showthread.php?t=228078

I am unsure what to preregister for threadid and what variable to use on the template. The hook I've tried is at showthread_complete.

I have tried all kinds of different vars and none seem to work. Search function grabs all kinds of answers but I think I am trying them out of context.

$threadid
thread['$threadid]
{vb:raw thread.threadid}
{vb:raw threadid}

/head explodes.

Any ideas?

kh99
09-01-2012, 11:01 PM
In your plugin code you can use $threadinfo['threadid']. If you want to use it in the SHOWTHHEAD template it's already registered, and you can use {threadinfo.threadid}. You would only need to register it if you're rendering a custom template, in which case you'd use register() (not preRegister). If you really do want to preRegister to one of the other existing vb templates (e.g. header, headinclude, footer), then you might want to use hook parse_templates (but it really depends on exactly what you're trying to do).

vauge
09-01-2012, 11:15 PM
Thank you! :)