Is there an API for bbPress
I have just checked your snippet and it just works great 🙂
So for fully public forums, this could be a quick win.
My only worry is that it does not take into account any bbPress ‘protection’ or ‘permission’. As it’s showing all forums, all topics, it’s not taking into account any specific bbPress settings or filters set. Some great plugins like bbP Private Groups is shielding data from being seen by unauthorised people and this should be extended to the API.
So I will try from a different angle. Authentication there will be my biggest nightmare probably 🙂
I have created my GitHub environment and plan to start putting the ideas on the wiki there: https://github.com/ePascalC/bbp-API/wiki
Please add your ideas !
Okay, I have put my first version on https://wordpress.org/plugins/bbp-api/
Please help me test it (replies should be added in the next days).
For all further questions/remarks concerning this plugin, please use the support forum of the plugin.
Hi, this topic has been very helpful in getting the latest replies, thanks Barry & Robin!
I’m trying to get the topic of the last five replies and later on construct the URL using the topic URL and reply # (kinda like Robin’s shortcode plugin does), but I can’t figure out how to do this.
I changed $author_id = get_post( $single_item[‘id’] )->post_author to $topic_id = get_post( $single_item[‘id’] )->topic hoping it would return the topic ID, but no luck. Is there a way to retrieve how to target this field?
By the way, Pascal, I tried your plugin but it doesn’t seem to work.
The endpoint I’m trying to use for instance http://example.com/wp-json/bbp-api/stats/ (or any in that scheme) throws a 404, including v1 in the URL just gives a blank page.
I was actually starting a topic about this, a few days ago, but my post contains a bunch of links (more than 3) to help contextualize the discussion and it’s still pending approval.
If moderators can help with that, the link to the topic is:
(I hope it’s not a problem to link it here; in case, feel free to delete or edit this reply)
I was trying to start writing a first version of a REST API too, as I missed the latest posts by Pascal. Also, I looked for existing code here:
but found only empty files. Am I missing something?
Anyway, I downladed the plugin and checked the code there.
Mine differs a bit as I was using BP-REST as a starter: I saw they had an extensive discussion about how to frame the whole work and structure it for the longer term, so I thought it was a good idea to take that into consideration.
If you think we might join efforts on this, let me know; I have limited time to invest on this but I’d be pleased to give my contribution whenever I can.
s t e
Assuming $single_item[‘id’] contains the id of the reply, this should do what you want:
$topic_id = get_post( $single_item[‘id’] )->post_parent;
@mapofemergence You are right, thanks! I didn’t expect topics and replies to be hierarchical.
@jpvanmuijen I started looking at how bbPress works under the hood just recently, so I’m learning these things just by looking into the code and trying to guess. I’m glad I didn’t give a wrong hint 🙂
I’m not sure if there’s any higher-level logic wrapping this in bbPress functions, though; any experienced bbPress guy is more than welcome to expand on this: I’d be happy to know if there’s a better way.
Hopefully, with the REST API this sort of tasks will become pretty straight forward 🙂
Can you update the github repo with your latest updated version of the plugin?
I would love to offer my changes and additions to it.
while waiting for the github by @casiepa to be updated, I managed to take some time to (partially) clean what I had written so far.
I published it on a repo, just in case anybody were interested in taking a look and opening a discussion about desirable ways to approach the problem and to structure the code.
Here it is:
s t e
- You must be logged in to reply to this topic.