Please or Register to create posts and topics.

Get all topics created by user

Hello

I’m currently building a community website (based on Buddypress) where achievements by users are listed on his/her profile. Among thoses are the number of discussions initiated on the forum (Asgaros Forum). So I need a way to retrieve topics created by a user — topics with at least on post from the author of the topic.  I found there are functions to get posts by user (AsgarosForumContent::get_posts_by_user / AsgarosForumContent::count_posts_by_user) but couldn’t find the same for topics.

Is there a smarter way to achieve this than to directly query database?

Thanks in advance.

Hello @glazfab

There are two functions you can use:

$asgarosforum->countTopicsByUser($userID);
$asgarosforum->countPostsByUser($userID);

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thanks. I will try these.

Asgaros has reacted to this post.
Asgaros