vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   pulling user id from outside forums (https://vborg.vbsupport.ru/showthread.php?t=203093)

feras 01-25-2009 09:37 PM

pulling user id from outside forums
 
so, I am looking to create a somewhat small system on my site, that involves the same users in the forums. Basically I want this features 'userbase' to be the same people in the forums.

Now, lets say my site is in the folder:
site

I also have a forums setup at site/forums/
which is where vbulletin is.

I'm trying to write a simple script in site, lets call this test.php, where it will also initialize the same session, and print that users ID if they're already logged into vbulletin.

I know lots about programming, but admit I don't know anywhere near enough about vbulletin, and if I can figure this part out the rest should be easy.

So again my test script is at:
site/test.php

Forums is at:
site/forums/

my test.php script I initially tried was
PHP Code:

<?php
require_once('./forums/global.php');
print 
$vbulletin->session->vars['userid'];
?>

But that was giving me errors from global and init trying to do other includes at other paths that dont exist relevant to this path.

Any help is appreciated :)

Voltar 01-25-2009 11:22 PM

The last three threads I've looked at had something to do with global.php and not doing a chdir first.

To fix the include path issues, try this:
PHP Code:

chdir('/path/to/your/forum/dir/');
require_once(
'./global.php'); 

Edit: Also, to fetch/print the userid of the current logged in user (if one is logged in):

PHP Code:

$vbulletin->userinfo['userid'


Dismounted 01-26-2009 04:29 AM

Quote:

Originally Posted by feras (Post 1724656)
I know lots about programming, but admit I don't know anywhere near enough about vbulletin, and if I can figure this part out the rest should be easy.

The Articles section is a good source of information on programming in vBulletin.

feras 01-27-2009 11:31 PM

worked like a charm. Thanks


All times are GMT. The time now is 01:17 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01031 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete