Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Integration with rails application and auto-creation of Categories/Discussions

edited May 2012 in Vanilla 2.0 - 2.8

Hello, I'm having a new video-streaming site be developed and we would like to allow people to comment on the videos ala youtube, however we also would like those comments to be in a forum interface as well.
I've been looking into using Vanilla forums because of the available plugins, theming, moderation tools, and ease of use, but there are a couple of things I'm not sure are easily possible.

One issue is that we'd like to have the rails application automatically create new Categories and/or Discussions when the application creates new Series or Video uploads in our CMS (and set permissions, first post data, etc). Secondly, we'd like to display the comments below the video but in a custom (highly simplified) view (with a link that goes to the full forum view), e.g. just query the comments from a discussion and redisplay them in custom rails views.
Can this all be done by directly modifying the database? Is there some simpler solution with an API or RSS feeds or direct http: requests?
I can't seem to find any decent documentation on how to accomplish this.

Thanks for any help.

Best Answer

Answers

  • Options
    x00x00 MVP
    Answer ✓

    best bet is to take a look at the blog comments part of this wordpress plugin

    http://wordpress.org/extend/plugins/vanilla-forums/

    then adapt it for your rails app

    grep is your friend.

  • Options

    So it'll require a custom plugin, basically...
    I looked in the code but I'm not a php expert so I can't tell how easy/hard it would be.

  • Options

    it would require rails integration, the embed code already exists for vanilla.

    grep is your friend.

  • Options

    Right, but I also need control over the categories and permissions from the outside app... wouldn't that require mucking directly in the database?

  • Options

    no it doesn't work like that, it works in reverse to that. The discussion controller has a special embed method, which will be used to initiate a discussion in that item (essentially scraping), then users can comment on the discussion and it is embedded in place.

    The rails side you will need to insert the embed.js, and and the other half jsConnect as is used as the sso.

    grep is your friend.

  • Options

    Right I know, but I need it to work in reverse. In our own CMS for uploading videos, whenever a new video is uploaded I want a new discussion created. Secondly, whenever a news "series" (a collection of videos) is created in our CMS, I need a new category created for that series. So I need a way to programatically create these structures outside the Dashboard.

  • Options

    It does that except it delay the creation until it is displayed once. You could also force it by pinging the server.

    Look at the discussion controller embed method.

    grep is your friend.

  • Options

    Maybe I'm misunderstanding something here... Basically you're saying that by embedding the embed.js in the webpage a discussion will automatically be created...
    How is that discussion organized in the forum itself? What contents does the first post have?
    I was thinking of having the metadata for the video be contained within the first post of the appropriate discussion thread and only displaying the "comments".
    It's important not just to have comments on videos but for users to use the more normal forum interface, head to the Category for the series and create their own discussion topics.

  • Options
    x00x00 MVP
    edited May 2012

    There is a default category and and a default system user, which you could configure.

    it scrapes the title (this can be a bit tricky depending on implementation but if you are pinging directly not an issue) and insert a link (not displayed in embedded form), however you could always create you own method through a plugin you you can create any new method of an controller, using the ControllerName_MethodName_Create 'magic method' form of the Pluign API. Basically have in there everything that the embed method does but adapt it to your needs.

    grep is your friend.

  • Options

    You can also override methods, but not a fan of this.

    grep is your friend.

  • Options

    Okay, looking at the discussions controller embed function...

    I see a bunch of foreign values like vanilla_ vanilla_category_id,... and in embed.js those are all set by vanillaUrl... I'm getting there :).

  • Options

    You could for instance set up equivalent categories, and it could work out where you want to put it.

    grep is your friend.

  • Options

    Okay, I think I understand how to do it now. Set up all the properties I want in javascript prior to calling embed.js, and when the first person views it the comment discussion will be created in the category etc that I define.

    What happens if the category ID doesn't exist yet? Does it automatically create a new one of those, too?

  • Options

    at the moment it just post in a single predetermined category.

    all of that you will have to develop yourself. Create a category, set the permissions on it per role (or just used the default). It is flexible system but it doesn't do everything out of the box.

    grep is your friend.

  • Options

    Hmm, if my devs could do php I'd have more confidence but they're pretty much rails + javascript. I think it's something I could attempt myself however after the fact. I'll consider it a last ditch effort in case we run out of budget.
    Might be a good project for someone here for some quick cash though, check back in 2 months to see if I'm offering quick cash to someone.
    Thanks for your help, you've definitely clarified what would be necessary to do the integration I was looking for.

  • Options

    btw FetchPageInfo uses ProxyRequest which is curl request. The page has to be publicly available.

    it is worth lookign at FetchPageInfo to see how it scrapes. You might want to implement your own version.

    grep is your friend.

Sign In or Register to comment.