Hello, trying to get a plugin working hammering here and there... what is the right way to refer to the current topic? I've seen around declaring global $topic and then using it as $topic->topic_id but no go. Any help? I'm trying to inizialize a variable with the id of the topic poster.
bbPress support forums » Plugins
How to refer to the current topic?
(3 posts)-
Posted 1 year ago #
-
What do you mean, no go?
This code should do it! At a wild guess, remember that globals have to be declared as globals again in each function.
global $topic; $topic_poster_id = $topic->topic_poster;It may also be helpful to know that the attributes or whatever they are (things after the ->) correspond to the columns of data in the table.
Posted 1 year ago # -
Alright! Somehow I had to do like this to get to it:
global $topic_id;
$topic = get_topic($topic_id);
$topic_poster_id = $topic->topic_poster;
Posted 1 year ago #
Reply
You must log in to post.