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.
Options

External Login Script

I did a search for login scripts on other pages then the forums and got a couple sudo code looking responces but nothing that i could get to work. Im still kinda new to vanilla but really would like this feature. What it needs. To be able to be included on any page and create all needed sessions, check login, Allow use to login if not already(this can forward to another page if its easier). Any help would be appreciated.

Comments

  • Options
    I'm not really sure what it is you need, could you be a bit clearer?
  • Options
    Sorry i hope this is more clear. I am just looking for a small chunk of code to place on the rest of my site not just my forums, to see if a member is logged in or not. If they are i want it to show their user name and if they are not then i want it to show a login link.
  • Options
    Ah I see. That's done easily enough, assuming you have a database connection further up in your code and also assuming your database table prefix is 'LUM_':

    if(!isset($_SESSION['LussumoUserID'])) { // Not logged in echo '<a href="path/to/login/page">Login</a>'; } else { // Logged in $sql = " SELECT * FROM `LUM_User` WHERE `UserID`='$_SESSION[LussumoUserID]' "; $User = mysql_fetch_assoc(mysql_query($sql)); echo $User['Name']; }
  • Options
    hum, It doesnt register that im logged in. I checked the sessions and they are empty. Any change i could get code to continue the session as well.
  • Options
    edited February 2008
    Nevermind got it. Didnt have my session_start() on the pages. Thanks for all your help.
  • Options
    do you think you could show me your site i would like to see how this works you can whisper it to me if you want
  • Options
    edited February 2008
    the site is www.osguide.net But i havent put the sign in part online just yet. hopefully by tomarrow i will.
  • Options
    Yeah, sorry, I realised this morning that I should have mentioned session_start();
  • Options
    Hi all, I need something similar. My users have to log in to my website and then they have access to my Vanilla forum, so I would like to add some code to also log them into the Forum. I think I can use the above code, but can you please tell me what code I can add to the registration page for my website that will also insert them into the Forum table when they are signing up for my website? This means they get to the forum pages and they are logged in. Also, I need to add a link to the navigation bar for users to get back to the rest of the website, and I can't find this in the code, maybe I could just be told what page to look on? Thank you, Nan
  • Options
    For the link, I would write a mini-extension to use the AddTab() function but other people like to suggest the PageManager add-on. I've never used it but that should do what you want. As for registration, it basically boils down to inserting the appropriate data in the appropriate tables. You can look at Vanilla's code for that.
  • Options
    When you say to look at Vanilla's code, can you tell me which file to look at? I have been trying to find this in the code for days. I have boiled it down to one of the people files, right? Thank you for your help.
  • Options
    edited February 2008
    Ok its online finally and working. I only had to add session_start() above the code but other then that I didn't have to change anything to the above code but i did just for looks, and so it would link to the correct login and register pages. You can check it out here

    http://www.osguide.net
  • Options
    @nan: library/People.Class.UserManager.php look at the CreateUser method.
  • Options
    is it possible to actually have a login box on an external page like a box for user name and a box for password kind of like this : http://twitter.com/ or facebook also is it possible to like integrate this other page with vanilla so when your logged in an viewing the external page it shows up logged in as blah blah and when your not logged in the boxes show up
This discussion has been closed.