ID of a forum

MartinHe

New member
Hi,
sorry, my english is not so good...

How can I find the ID of a subforum in a template?
The group of a user goes with {$visitor.user_group_id}
How is this for a forumsID?

thank you

Martin
 
It depends which template.

It would usually be either:
Code:
{$forum.node_id}
Or:
Code:
{$node.node_id}

Though sometimes the current node can be identified within the context of the content being viewed, e.g. on the thread view it could be found with:
Code:
{$thread.node_id}
 
Super, THX. It works.
Another question:
On left side, the userfield.
Where i can get the userid?
{$user.user_id} don't work at this place

And {xen:helper dump, $user} is NULL
 
Are you wanting to get the user ID of the logged in user?

If so, that will always be {$visitor.user_id}.

If it's the user ID related to the content, that would usually be {$user.user_id} or, e.g. for the list of posts you could use {$post.user_id}.
 
mhh.. ok. {$visitor.user_id} works, but {$user.user_id} and {$post.user_id} don't work.
I must have the id oft the User on the left, and the post-id of the post..
 
{$message.post_id} and {$message.user_id} might work. Again, it depends on the template where it is being used.
 
Mhh .. Then I'm doing something wrong ...

In my own template I write the following:
{$ Visitor.user group_id} {$ message.user_id} {$ message.post_id}
Only the visitor.user_grou_id works.
The add-on is my own, it is also selected below in the template.

There is also a separate listener:
Event to listen: template_hook
Callback is Info_listener :: template_hook

The listener.php is in the correct directory

class Info_listener
{
Public static function template_hook ($ hookName, & $ contents, array $ hookParams, XenForo_Template_Abstract $ template)
{
If ($ hookName == 'message_content')
{
$ OurTemplate = $ template-> create ( 'Info', $ template-> getParams ());
$ Rendered = $ ourTemplate-> render ();
$ Contents. = $ Rendered;
}
}
}
 
If you use Template Modifications instead you most likely won't have this issue.

Template Hooks are deprecated and they should be avoided.
 
Mhh. OK thanks. I'm a beginner here.
How can I then solve my problem, an extra text under a user and under a posting?
I have in an extra DB data that must be under each posting and under each user left of a posting

TX for your help
 
Top Bottom