Where do I find discourse functions?

Hello, When I want to add a display somewhere that shows how many posts the user has commented on or similar, where should I look for these functions?

Thnak you

The API documentation is available at https://docs.discourse.org/

2 Likes

Also for client-side related, there is the pluginApi file that has many functions you can make use of. Each method is also nicely documented.

4 Likes
<li class="stats-post-count linked-stat">
            <LinkTo @route="userActivity.replies">
              <UserStat @value={{this.model.post_count}} @label="user.summary.post_count" />
            </LinkTo>
</li>

Can I somehow append this code to make it work?

This code is from the user summary page where the stats are displayed. In this context, you have access to the post_count on the model.

So it really depends where you want to add your display. If its already present in the model it may work, but more often you’ll need to add some logic to fetch that data.