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.

Integrate Vanilla with existing website

edited November 2010 in Vanilla 2.0 - 2.8
is there any guide on how to integrate login and register buttons from vanilla header into my existing website.
Tagged:

Comments

  • LincLinc Detroit Admin
    You could simply link to those pages. That'd be the easiest way.

    If you mean creating them as popups, I'm not sure how to do that off the top of my head.
  • yea, but I also want to show when user is loged in forum to display his info, logout, etc... links on my website. What files I should focus on?
  • LincLinc Detroit Admin
    That's a bit more complex than simply integrating buttons.

    I conjecture it would require a standalone script to authenticate the user and get their data from the database. I don't know of a more elegant solution, but there may be one.
  • That sounds like you may want SingleSignOn aka ProxyConnect
    what is your website running? WordPress, Drupal or something else?
    or consider other options such as openID, google, FaceBook,Twitter, i.e. SocialConnect etc see the release notes for V2.0.14
  • edited November 2010
    sorry for late reply. Well what I actully want is to know which file I need to include/attach to my php files so I can e.g. have fallowing thing work:



    <?php
    $Session = Gdn::Session();
    $Authenticator = Gdn::Authenticator();
    if ($Session->IsValid()) {
    $Name = ''.$Session->User->Name.'';
    $CountNotifications = $Session->User->CountNotifications;
    if (is_numeric($CountNotifications) && $CountNotifications > 0)
    $Name .= ''.$CountNotifications.'';

    echo Anchor(
    $Name,
    $CountNotifications > 0 ? '/profile/notifications' : '/profile/'.$Session->UserID.'/'.$Session->User->Name,
    'Username'
    );

    $Inbox = 'Inbox';
    $CountUnreadConversations = $Session->User->CountUnreadConversations;
    if (is_numeric($CountUnreadConversations) && $CountUnreadConversations > 0)
    $Inbox .= ''.$CountUnreadConversations.'';

    echo Anchor($Inbox, '/messages/all', 'Inbox');

    if ($Session->CheckPermission('Garden.Settings.Manage')) {
    echo Anchor('Dashboard', '/garden/settings', 'Dashboard');
    } else if ($Session->CheckPermission(array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'))) {
    echo Anchor('Users', '/user/browse', 'Dashboard');
    }

    echo Anchor('Sign Out', str_replace('{Session_TransientKey}', $Session->TransientKey(), $Authenticator->SignOutUrl()), 'Leave');
    } else {
    echo Anchor('Sign In', $Authenticator->SignInUrl($this->SelfUrl), 'SignInPopup');
    echo Anchor('Apply for Membership', $Authenticator->RegisterUrl($this->SelfUrl), 'Register');
    }
    ?>

    I DONT have any user registration system so that why I want to use my vanilla database and enable users to login/logout using existing vanilla system on my other parts of website. Hope somebody understood what I actually need. Thanks!
  • any suggestions?
  • any1?

    or its not that simple?
  • LincLinc Detroit Admin
    None of that code will work because your site isn't loading up core Vanilla in the background. You'd need to independently check for a valid Vanilla cookie with something like this: https://gist.github.com/700805

    And then base the rest on whether it validates.
Sign In or Register to comment.