We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25626
    • 3 Posts
    I have currently installed modx for testing purposes and I have integrated it with a vBulletin forum using the banzaitokyo Plugin which is all working fine.

    I have now written a snippet that gets the logged in users details using the vBulletin sessionid which is all fine but currently I have to include the php code in each plugin/module/snippet (I don’t know what to call them they were plugins in subdreamer) i.e. latest posts, users online, latest polls etc.....

    What I would like to do is create a global variable so I can access this from any piece of code i.e create something like $modx->vbinfo->id or create my own $vbinfo to be used wherever I would like.

    Should I do this via a plugin and call it on page load ?

    I am not the most technical so bare with me...

    Thanks in advance

    Paul
      • 3749
      • 24,544 Posts
      You could save the info in a $_SESSION variable as long as MODx and VBulletin are sharing the same session.

      $_SESSION['vbinfo'] = $your_info;
      
      $my_info = $_SESSION['vbinfo'];


      The second line should be good anywhere, although you may have to put a session_start(); above it to make it work.


      http://us.php.net/session
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting