Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is there an API for bbPress

Viewing 25 replies - 26 through 50 (of 76 total)
  • Hi @barryhughes-1,
    Should I start an environment on GitHub for this ? I really really love the idea of the bbPress API. It has been on my radar for a while but lost priority.

    I had this link already saved to get some ideas https://github.com/thenbrent/BB-API

    Pascal.


    Barry
    Participant

    @barryhughes-1

    Sounds like a great idea to me!

    Hi @barryhughes-1,

    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 !
    Pascal.

    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.
    Pascal.


    jpvanmuijen
    Participant

    @jpvanmuijen

    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?
    Thanks again!


    jpvanmuijen
    Participant

    @jpvanmuijen

    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.


    mapofemergence
    Participant

    @mapofemergence

    Hi everybody,
    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:
    https://bbpress.org/?post_type=topic&p=181440
    (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:
    https://github.com/ePascalC/bbp-API
    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.

    Cheers,
    s t e


    mapofemergence
    Participant

    @mapofemergence

    @jpvanmuijen
    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;


    jpvanmuijen
    Participant

    @jpvanmuijen

    @mapofemergence You are right, thanks! I didn’t expect topics and replies to be hierarchical.


    mapofemergence
    Participant

    @mapofemergence

    @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 🙂


    tpsr51
    Participant

    @tpsr51

    Hi @casiepa.
    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.

    Hi,
    Plugin is on https://wordpress.org/plugins/bbp-api/ but let me see to copy the code to GitHub this weekend.

    @jpvanmuijen
    on 2 of my forums it seems to give stats, but we should have that discussion at the support forum for bbp-api 🙂
    Pascal.


    mapofemergence
    Participant

    @mapofemergence

    Hi there,
    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:
    https://github.com/mapofemergence/BB-REST

    cheers,
    s t e


    TKServer
    Participant

    @tkserver

    I’m happy to have found this discussion. Shortly after making an iOS/Android app out of one of my WP blogs I will embark on making a mobile app for my bbPress based forum at UteHub.com. So naturally I started google bbPress API.

    I have yet to look at what’s returned by the bbP api plugins in this thread, but why not just use a custom post type function to add to the WP api? Is there something coming from these bbP api’s not in there?

    I will be developing my bbPress app in Angular JS 1.x. I’m sure I’ll be participating more as I get into the project.


    mapofemergence
    Participant

    @mapofemergence

    Hi @TKServer, I’m glad you revamped this topic.
    Although since my last post I didn’t work further on the code, I’m still very much interested in the discussion.
    Originally, I was going in the same direction that you just suggested but, ultimately, I thought that a separate API would be desirable for a variety of reasons.

    I can name the ones I thought of, but I’m sure others might have even stronger (and more educated) motivations:

    • the most general and obvious: a separate API makes you less dependant on certain builtin constraints of WP API and let you take design decision which are more tightly connected with bbPress specifically; even though bbPress leverages WP’s custom post types and tags, there’s a higher layer of abtraction (read: forum functionality) which implies a whole set of requests for which the existing endpoints’ structure is not ideal
    • depending on what info you want to get with a single request, the default WP API queries might not serve the scope well (ie. they could force the user to make multiple queries where just one would be desirable and sufficient; also, where multiple database calls are required, it might not provide those in the best performing way)
    • from a user standpoint, I believe it is better to offer schemas (and filters) which reflect more the semantics of a forum, than the ones of a blog; I believe you can still build those custom terms in the existing API, but it might become confusing soon, and in my opinion you’d loose the advantage of staying with a single API, anyway
    • additionally (and actually the main reason for me personally), I see bbPress as part of an ecosystem, with WP and BuddyPress. Since BuddyPress already went for a separate API, I thought it would make sense to do the same with bbPress, keeping things clean and separate. Utlimately, the ideal would be to have the bbPress API live with the bbPress plugin itself, so that the development of the two can progress together (and therefore be more efficient and optimised, both ways)
    • finally, speaking of bbPress BuddyPress, there’s an area where the two plugins overlap (bb forums in BP groups); I believe it is already a non-trivial problem to solve in a separate API and it would likely be even more complicated to try and stay within the WP limits; I was mentioning this in another post too, which I believe is still awaiting approval from moderators (please pardon me if I dare poking them here, once more) 🙂

    Again, this is just my opinion; there are probably pros and cons in both options and I’d be more than happy to hear from anyone who’s more bbPress-savvy than I am.

    Cheers,
    s t e


    TKServer
    Participant

    @tkserver

    Sounds like you’ve put some good thought into it @mapofemergence and I hope to contribute on the front end side with suggestions and reports on how I’m able to get it to work, if you’d like some input/help.

    I hope to start on my bbPress mobile app in the next week or two.


    mapofemergence
    Participant

    @mapofemergence

    @tkserver please do keep me/us posted about your progress.

    I’m not familiar with Angular JS, at all, but I’ve invested quite some thoughts on the frontend too; my implementation is a basic and quite old-school combo of PHP and AJAX jQuery but, still, that doesn’t mean I’m not aiming at a smart and fresh UX 🙂

    I’m very interested in hearing other people’s thoughts, both with regards to usage philosophy and in terms of code implementation. I firmly believe that’s the best (possibly the only) way to make the right choices, early in the development, for the backend to be generalized and robust enough to serve everybody’s requirements.


    TKServer
    Participant

    @tkserver

    I’m starting development of my bbPress mobile app. I have noticed that buddyPress has an RSS feed for latest member activity, which also has bbPress posts. One could utilize that, but it is very limited and shows multiple duplicates of the same post if a user edits.


    TKServer
    Participant

    @tkserver

    I’ve already got the “latest posts” feed working with post titles and dates. One catch is that I can’t get the author’s name because the WP API won’t allow it, presumably to prevent name harvesting. So I may have to make a custom API for that.

    Hi all,
    Just to keep you informed (I forgot to post the link here before) that some people already provided input on the bbpress API version that is on https://github.com/ePascalC/bbp-API/
    It’s setup in a different way, but if anyone wants to help building/proposing things on that one, feel free. I hope in the end both will serve to come to a final bbPress integrated API.
    Pascal.


    TKServer
    Participant

    @tkserver

    I’ve started coding an angular/mobile bbPress app. I’ve already got a “latest topics” feed working in the app via the API by @mapofemergence and it works great. I just ran into the first hurdle, which is that WP’s API does not allow access to user info. A custom API to get the user’s name and avatar etc would be needed.


    @casiepa
    I will check yours out as well.


    TKServer
    Participant

    @tkserver

    @casiepa is there paging on your api? I like how your topics have reply counts in the object.


    TKServer
    Participant

    @tkserver

    Pardon all my posts. You know what would be a great end point? A single topic with a replies object. Can that be done? One call which has the topic and all its replies. That might be too hard to do because of ordering of the replies as in threaded or non threaded etc.

    Should not be too hard to implement into /bbp-api/topics/id (https://github.com/ePascalC/bbp-API/wiki/API-routes)

    You get the topic data there and then an extra array with all replies.


    TKServer
    Participant

    @tkserver

    Should not be too hard to implement into /bbp-api/topics/id (https://github.com/ePascalC/bbp-API/wiki/API-routes)

    You get the topic data there and then an extra array with all replies.

    Along those same lines, an object including the authorId, author name, and author hashtag in the api would eliminate a need for another custom api call for user info. WP does not allow hitting user info publicly to prevent name scraping I guess.

Viewing 25 replies - 26 through 50 (of 76 total)
  • You must be logged in to reply to this topic.
Skip to toolbar