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.
Interaction with Vanilla outside of it
Wargog
New
Hi, I was just wondering, is there any way to interact with Vanilla, things like grabbing profile pics, seeing if the user is logged in and displaying a message if they're not? Using what I've put here, like displaying a link to the users settings page and displaying their profile pic if they're logged in, or displaying the login button if they're not?
0
Comments
There are two API one is available as an App, with the upcoming 2.2 version which atomic and based on models, which is useful for write operations.
There is a basic one user normal controller an need no api key.
http://vanillaforums.org/profile.json
See what happens when you are not logged on.
Note "Logged on" is not a state, HTTP is stateless. One is only logged on by virtue of a session cookie which comes with every request. There no such persistent state on the server (even if you can imply it under some systems).
If you are same domain session can be respected, through JavaScript. you can't do this on the server as it is the browser than has the cookie. If you stick to client-side scripting it makes it easier.
grep is your friend.
You can also use that api to fetch vanilla modules, and you you can create your own modules.
grep is your friend.
I don't see that file on my forum installation. Is it a plugin or something that I should use?
Url scheme and files are not the same. Modern frameworks are not based on multiple entry point as files. Vanilla is based on single entry point single dispatcher as default. The fact that url scheme may coincide with file structure is merely a coincidental design implementation of some early web servers.
As early web apps tended to use multiple entry point his might lead to that impression.
Don't assume becuase you see something like
/profile.json
it is reference to a file of the same name. If it was it would be static, as a json files are not normally a script itself.In this case it refers to the profile controller of dashboard application, as the method is not specified it is the index method.
.json
tells to return a json object of the data rather than the view.Look up MVC frameworks for an overview.
Anyway this by the by. You can use that json to in javascript. You can make a Ajax request check or use that data a is javascript.
Note, if you are never done any programming this a bit advanced.
grep is your friend.
I have definitely done a lot of programming before, I'm just getting into how different thing interact with the web though. Web programming is a lot different than desktop programming. Would this work using GET requests? http://vanillaforums.org/addon/api-application
Nevermind, it's for Vanilla 2.2, anything else I could use?
It's like @x00 told: you can use json files. Look at the differences between these two links:
http://vanillaforums.org/profile.json/56203/Wargog
http://vanillaforums.org/profile.json/44046/R_J
If you are logged in and you open your own profile with the above link, you'll find a "transient: ...". entry. You would need to make an AJAX call so that it could work.
Another page you could check from within an AJAX call would be http://vanillaforums.org/module/memodule.json