Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 12-21-2008, 11:30 AM
cashaddy cashaddy is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Problems with: $vbulletin->userinfo['userid'];

Hey mates,

got a small problem, which is already transformed to a major one...

i want to add a login box to my wordpress frontend, and if the user is logged in to the forum it should display a welcome message and some related stuff...

main facts:

i am including the global.php while using this code (added it to the header.php in wordpress. that it's openend on every page):

if (!file_exists('/path/forum/global.php')) { echo "++++ IT!";
exit; }

require_once('/path/forum/global.php');


got that code in my sidebar:

$userid=$vbulletin->userinfo['userid'];
echo '"'.$userid.'"';

the result i get: "" => that means, i can't read the userid of a logged in user.

got any tipps? would be pretty happy if yes
Reply With Quote
  #2  
Old 12-21-2008, 11:33 AM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where is your wordpress script in relation to your forum? The issue will be the cookies on your forum won't also be on the wordpress site.

You could probably fix this by setting the vb cookie path to /.
Reply With Quote
  #3  
Old 12-21-2008, 11:41 AM
cashaddy cashaddy is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

wordpress installation is located in : domainname.de/
vb installation is located in: domainname.de/forum

i have already set the cookiepath to /
i also set the cookiedomain to .domainname.de

i think i will get insane soon
Reply With Quote
  #4  
Old 12-21-2008, 11:43 AM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well I know my test forum is on /test/, I can access the vB cookies on the main part of my site which is in a folder up from test/. I only have cookie path to set /, no cookie domain setting.

Try logging out of your vB forum, then back in so vB re-makes the cookies for you
Reply With Quote
  #5  
Old 12-21-2008, 12:08 PM
cashaddy cashaddy is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

haha, i just uploaded a test.php which includes my code to the /forum directory, and. guess what. it's working. ...

i don't know why, but it don't want to work in the "/" directory...

if i am testing it without wordpress (simply using the test.php, stand alone file) it says, that the paths inside of the global.php are not correctly anymore.

i would have to add the /forum/ path inside of the global.php to all file-paths. like for the /includes/init.php ... otherwise it won't work - i think.
Reply With Quote
  #6  
Old 12-21-2008, 12:09 PM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perhaps try:
Code:
chdir('/path/to/forum');
require_once('./global.php');
chdir('/path/to/wordpress');
Reply With Quote
  #7  
Old 12-21-2008, 12:31 PM
cashaddy cashaddy is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Deceptor View Post
Perhaps try:
Code:
chdir('/path/to/forum');
require_once('./global.php');
chdir('/path/to/wordpress');
don't want wo work

the strange => the wordpress vbbridge plugin is working correctly.

that means, the plugin requires the global.php on the same way like me... AND it's working in the plugin . but not on the frontend, really really strange.

PHP Code:
<?php
    
          $vwd 
'/path/forum';

          
$cwd getcwd(); /* cwd == "/path" */

          
chdir($vwd);

          if (!
file_exists($vwd '/global.php'))  { echo "cannot include $vwd2/global.php.  You should check your path!"

          exit; }

          require_once(
$vwd '/global.php');
          
$useriddd $vbulletin->userinfo[userid];

          
chdir($cwd);

          echo 
'"'.$useriddd.'"';

?>
Reply With Quote
  #8  
Old 12-21-2008, 12:53 PM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe a wordpress cookie is conflicting, do you have a unique cookie prefix for your vBulletin?
Reply With Quote
  #9  
Old 12-21-2008, 01:19 PM
cashaddy cashaddy is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, i have got a unique cookie prefix for my vbulletin...

got the problem: it doesn't want to work in the wordpress theme!!

tested it in the "/" dir in a excluded file and suddendly it did a good job.

damn it. now i have to find a solution for that - i hate such situations !
Reply With Quote
  #10  
Old 12-21-2008, 01:29 PM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have an idea, I remember issues with wordpress and variable scope

before you call global.php using require, place this code before it:
Code:
global $vbulletin;
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:39 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09005 seconds
  • Memory Usage 2,260KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete