[Widget]Realtime topic updates

Plugin Development
  • I need to know if there is an client side ajax method that i can use to poll for latest topics from selected categories. if there isn't, please suggest an alternative approach.

  • You can get the data from any route by adding /api to the front of the route.

    $.getJSON('/api/category/1', function (data) {
        console.log(data.topics);
    });
    

    Will return up to the 20 most recent topics. The same that the user would see if they were viewing the page for category 1.

  • @yariplus said:

    $.getJSON('/api/category/1', function (data) {
    console.log(data.topics);
    });

    I think i got this as a response for the request: "/category/1/announcements"

    Don't know if i am doing it wrong. I created a new html widget and added your script inside a script tag. In the console, I am not getting anything. But i can see the request is successful, but there is no console.log outputting. In the network tab, i can see the response for this request as : "/category/1/announcements"

    Sorry for the bad english

  • Anyway, I get all the categories and topics using this route: /api/categories

    I think there is details on all topics also.


Suggested Topics


  • 0 Votes
    2 Posts
    352 Views

    I suggest using user.updateProfile to make these changes, since it updates the necessary sorted sets for email/fullname.

    You can use the same function to update the picture url as well.

    await User.updateProfile(callerUid, { uid: targetUid, uploadedpicture: url, picture: url, }, ['uploadedpicture', 'picture']);
  • 0 Votes
    1 Posts
    809 Views

    Good morning.

    First of all, I'm not a developer, and I'm sorry for every noob question that comes up here.

    Right now I'm playing around with the plugin/widget development. My goal is to have a widget which includes a search bar and a result div. Every change in the search input field fires a jquery request against a foreign api. Result is a big json object, containing an array of objects (example fields: image, name, uuid, type).

    I was able to put the plain results into the div. Now I want to process these results (splitting them up by type) and render them into beautiful partials.

    For your imagination:
    <search box>
    <box for type A with a list of entries> <box for type B with a list of entries>...

    Can anyone please give me a headstart?

    Thanks in advance.

  • 0 Votes
    3 Posts
    1k Views

    Yep, ended up using posts.isMain function.

  • 0 Votes
    3 Posts
    1k Views

    Awesome ty so much 🙂
    I ended up making the call to Categories.getCategoryTopics() but I may switch back to the method you posted above 👍

  • 0 Votes
    2 Posts
    2k Views

    Would the Q&A plugin be closer to what you want?