Vanilla forums [authenticate outside forum]

Is there anybody here that works with vanilla forums? I want to use the vanilla forums authentication outside the forum. Does anybody know how to do this? I have searched the files for examples but no success, i even googled it but even that was without any success.

Hope someone can help me with this.

Greetz Dizcow

so once they authenticate with the forum on your site, you would like to use that authentication in other parts of the site? eg: a members only area.

Yes correct, with wordpress its easy:

$UID = wp_validate_auth_cookie();



if(empty($UID)){
    
    header("location: http://mainsite.com/");

}else{

    $user_info = get_userdata($UID);

}

But i cannot find this on vanilla.

Try something along the lines of:

define('APPLICATION', 'Vanilla');
define('APPLICATION_VERSION', '2.0.16');
define('DS', '/');
define('PATH_ROOT', 'path-to-forum');
ob_start();
require_once(PATH_ROOT.DS.'bootstrap.php');
ob_end_clean(); // clear any header output from vanila
$Session = Gdn::Session();
$Authenticator = Gdn::Authenticator();
if ($Session->IsValid()) {
   $Name = $Session->User->Name;
   echo "You are logged in as $Name";
}else{
  echo "You are not logged in";
}

change path-to-forum above.

I’ve just put this on my site, it works from a php script outside of my vanilla forum:

[link]

enjoy!

dave.

Works perfectly, thank you very much for taking the time to help me with this :slight_smile:

I can now integrate my account verification for item support.

DizCow said

I can now integrate my account verification for item support.

Feel free to share it when you have it working

I will absolutely do that, ill keep you in touch :wink:

Is there any way to check if the user is logged in in the vanilla forum using a WordPress page template?

You can install plug in “php anywhere” if i am correct, then you can use this class to check if user is logged in :wink:

http://code.google.com/p/dizcow/downloads/detail?name=vanilla_outdoors_1_0.rar

dtbaker said
DizCow said

I can now integrate my account verification for item support.

Feel free to share it when you have it working

Cant share it here, it will be reported every time i do it :wink:

Hi DizCow

I’m using your class but only works if i use it in the index.php file of the vanilla forum, i’ve tried to use it in a page template in WordPress but all the content disappears.

The problem with the class is that if the user is not logged in then he can not register, etc.

I am working on a newer version of this class, give me a few days and ill upload the new class :wink:

Oh man you are amazing, i’m crating a forum support for my themes and i want to use vanilla forums, everything is working till now, the purchase verification, etc. now i just need to check if the user is logged in in the forum using a WordPress page template, this way the user does not have the enter the purchase information to access to the forum all the time.

Well i found exactly what i needed with dtbaker’s code, now is working correctly.

manu3l9816 said

Well i found exactly what i needed with dtbaker’s code, now is working correctly.

glad you got that sorted, sorry I didn’t get time to reply to your comment via my website. busy weekend.

nice. where can we find the updated version?