Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Integration of Login procedure
Anyone got some hints on integrating the login/session procedure of vanilla into another site?
I would like to integrate a login box into my site which would start the session on the vanilla user database. I'd like to carry this session over different pages and when opening the forum itself the user shouldn't have to login again.
0
This discussion has been closed.
Comments
http://lussumo.com/docs/doku.php?id=vanilla:integration:wordpress
All the people classes in the framework folder handle the authentication and registration inside Vanilla. Not having done this myself (yet), you probably just have to include them in the same manner that Vanilla does.
Then i wrote a delegate function attached to login process to perform needed action, in my case this is checking against another database, in your it might just be putting some variable in the session array.
Basically, write a simple extension to attach to the proper delegate:
if ($Context->SelfUrl == 'people.php') { $Context->AddToDelegate("SignInForm", "PreValidPostBackRender", "your_custom_function"); }
If so, you just forgot to delcare what the $Username, $Password and $Remember vars are:
include('appg/settings.php'); include_once("./forum/appg/init_people.php"); // get those parameters from the login $Username = ''; $Password = ''; $Remember= ''; // $Ret should be the $UserID if the login has been successful $Ret = $Context->Authenticator->Authenticate($Username, $Password, $Remember); if ($Ret > 0) { // user has been authenticated, send him to the homepage }
<?php // ADAPT PATHS TO YOUR SETUP include("../forum/appg/settings.php"); include_once("../forum/appg/init_people.php"); if ($Context->Session->UserID) { //user is logged in - show name and logout link; echo '<li>'.str_replace('//1', $Context->Session->User->Name, $Context->GetDefinition('SignedInAsX')).' (<a href="'.$Context->Configuration['SIGNOUT_URL'].'">'.$Context->GetDefinition('SignOut').'</a>)</li>'; } else { // user is not logged in - show login link; echo '<li><a href="'.$Context->Configuration['SIGNIN_URL'].'">'.$Context->GetDefinition('SignIn').'</a></li>'; } ?>
When called up in the browser it works fine, replicating the behaviour on the forum exactly.
However, as soon as I include it from my smarty template with it refuses to work at all. I've checked the smarty settings and php is allowed and security is set to false. I temporarily added echo statements to the included files to see if they were indeed being referenced and they are — the echoes appear but nothing else.
I'm not a smarty afficionado, so can anyone advise on any possible conflicts or ways around it?
no ideas anyone? I'd really like to get this working.