Extending The API
-
Hello,
Firstly, thanks for the BBP API, it has been very helpful on a project I am working on.
I am, however, in need of adding additional fields to the API, for example the site in question uses a plugin that allows up/down voting of posts etc. and I need to add info to topics and replies that show the number of up/down votes.
I initially tried to use register_rest_field() but this doesn’t seem to work, and on further inspection of this plugin it doesn’t look like there’s an opportunity to add fields into these responses.
I was thinking that even something as simple as an apply_filters() function in each of these places might give an easy way to add extra data in and wanted to see what you thought. If there’s a repo somewhere for this plugin I’m happy to make these changes myself and push them back:
- inc/forums.php – filter $all_forums_data after line 28
- inc/topics.php – filter $all_topic_data after line 53
- inc/replies.php – filter $all_reply_data after line 32
Thanks,
The topic ‘Extending The API’ is closed to new replies.