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.
how to catch login session
jackmaessen
✭✭✭
I want to make a normal website on the main domain, seperated from the forum, and the forum on a subdomain, lets say: www.mywebsite.com/forum
I also want users give the oppertunity to login on the main page and i want to do that with the login session of the forum.
So when they already have logged in on the main page and go to the forum n the subdomain, they see that they are already logged in. What is the most easy way to make this possible?
I used to do this before with Custom pages or Extra page addon, but it is very devious. You are still captured in the frame of the forum and you do not have really a free hand to make your own page.
Tagged:
0
Comments
Create an application called "nano" and create those two subfolders/files:
/applications/nano/settings/about.php
/applications/nano/controllers/class.nanocontroller.php
After activating your application, looking at yourpage.com/nano will give you one single line of output: "UserID = whatever".
Maybe you can achieve the same with a plugin, but since you want to create a custom page that should not be a simple addition to your forum, it feels more logical to me to set it up as an application
Just fetch the profile or memodule via ajax. That gives you the exact data you want without writing any custom code.
E.g. http://vanillaforums.org/profile.json will give you the profile object of the logged in user. If no user is logged in, the json object returns a 404.
E.g. http://vanillaforums.org/module/memodule will return the html markup of the me module for the logged in user. If no user is logged in, it will give you sign in and register links.
I guess I am just lazy.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Thank you @R_J and @hgtonight.
I will look at these options.
That is a good feature of a programmer. It means you work efficiently without unnecessary operations.
i tried to fetch the html hgtonight supoorted above.
I did it this way: in the custom page in a testdirectory i put this line in the index.php:
On the forum (forum.webprofis.nl) i am logged in.
But in the custom page (forum.webprofis.nl/testdirectory/index.php) i see the options "Login" and "Register".
But these should not appear because i am already logged in on the forum
That will not work because the server is requesting the page, not the client. If you request the page via JavaScript the client's "session" is continued and you will get the expected outcome.
You can do it server side, just not the way I was suggesting it. You either have to load the framework's session object or parse the Vanilla cookie yourself.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.