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

Getting current logged in user from external files

edited December 2007 in Vanilla 1.0 Help
I'm trying to semi-integrate Vanilla with another PHP file (it will be located at /roadmap/index.php, Vanilla is located at /forums/). I need to get the username, email address and URL if applicable. Should I use the following code, then do a var_dump() to find out the properties/members of $Context?
include_once("./forum/appg/settings.php"); include_once("./forum/appg/init_people.php");

Comments

  • Options
    OK, it seems to be stored in $Content->Session, however it doesn't get any information. Will I need to change the cookie path?
  • Options
    Well, it's still not working, even with that.
  • Options
    Also, this example appears to be out of date.
  • Options
    OK, I've finally got it working, after I changed the cookie path back. However, it doesn't give $Context->Session->User->FullName, even though I have it set in my account settings. Any ideas?
  • Options
    I'm going to go on a guess here. Do I need to read the settings from the database?
  • Options
    That would certainly be one way to do it. I'm pretty sure it should be in the user class somewhere though...
  • Options
    I did this for an external Page Manager page but I am not home at the moment. I will check it out soon and let you know what I did.

    It may not be the correct way but hey, it woiks for moi!
  • Options
    Was it something like Mark's example? Because I thought that was only when using cookies, not sessions.
  • Options
    Sorry mate, the week-end was hectic, didn't get around to it.

    There's a couple of files you need to link to in the external page, maybe these two...
    <script type="text/javascript" src="/.../js/global.js"></script> <script type="text/javascript" src="/.../js/vanilla.js"></script>
    I will look it up first chance I get though, come to think of it, there is also a PHP file or two you'll need to link to.
    Do keep hassling me, I am all over the place at the moment.
  • Options
    Sure, I understand. I was busy getting Christmas stuff ready :)

    OK, so what exactly are those JS scripts used for? I'm thinking that they may only be needed for the actual forum pages, but then again, I have been wrong before. :P
  • Options
    I've looked, I can't seem to find any reference to external files (maybe I was dreaming) but I did find this snippet which returns the logged in user...

    <?php echo $this->Context->Session->User->Name; ?>

    Posted: Monday, 10 December 2007 at 8:05PM

  • Options
    Yes, but I'm trying to get the details, such as $Context->Session->User->FullName

    Do I need to query the database or not to get that information?
  • Options
    I guess I'll just use the DokuWiki session, since it's integrated with Vanilla anyway...
This discussion has been closed.