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 in a site : sessions
Hi,
I'm creating a web-site. I'd like to access to Vanilla functions and sessions from my web-site. When a user signs in on Vanilla forum, I'd like to get his userid and other informations in my web-site.
In a PHP file, I wrote the following lines:
If I put the PHP elsewhere, it doesn't work: UserId is always 0.
I've searched on the forum and on search engines, but I didn't find anything. I changed the cookie path and set to "/", but this still doesn't work.
Does anyone have an idea (or a link) for my problem?
Thanks.
I'm creating a web-site. I'd like to access to Vanilla functions and sessions from my web-site. When a user signs in on Vanilla forum, I'd like to get his userid and other informations in my web-site.
In a PHP file, I wrote the following lines:
error_reporting(E_ALL);If I put the PHP file in Vanilla directory, it works fine and I can see my UserId.
include('./forum/appg/settings.php');
include('./forum/appg/init_vanilla.php');
echo "UserID = " . $Context->Session->User->UserID;
If I put the PHP elsewhere, it doesn't work: UserId is always 0.
I've searched on the forum and on search engines, but I didn't find anything. I changed the cookie path and set to "/", but this still doesn't work.
Does anyone have an idea (or a link) for my problem?
Thanks.
0
This discussion has been closed.
Comments
Fatal error: Cannot redeclare addconfigurationsetting() (previously declared in path\forum\library\Framework\Framework.Functions.php:22)
I removed the include of "init_vanilla.php". The error message disappeared, but it still prints "0".
$full_path_to_vanilla = '/full/path/to/vanilla/here'; ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $full_path_to_vanilla); error_reporting(E_ALL); include('appg/settings.php'); include('appg/init_vanilla.php'); echo "UserID = " . $Context->Session->User->UserID;
This gives exactly the same result.
My file in my "php" directory prints : "UserID = 0".
My file in my "forum" directory includes the other page (so, I'm sure it's the same code that's executed) prints : "UserID = 1".
I believe this is connected to sessions and paths, but I don't know exactly how things work.
$Configuration['COOKIE_DOMAIN'] = 'www.example.com'; $Configuration['COOKIE_PATH'] = '/forum';
If you need the session to be accessible at www.example.com/, you need:
$Configuration['COOKIE_DOMAIN'] = 'www.example.com'; $Configuration['COOKIE_PATH'] = '/';
If you need the session to be accessible at blog.example.com/, you need:
$Configuration['COOKIE_DOMAIN'] = '.example.com'; $Configuration['COOKIE_PATH'] = '/';
http://lussumo.com/docs/doku.php?id=vanilla:integration:dokuwiki
It works.
I've set my cookie path to '/' in Vanilla.
http://lussumo.com/docs/doku.php#external_application_integrations