Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-07-2010, 07:08 PM
manu3569 manu3569 is offline
 
Join Date: Jan 2010
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Accessing User Info in Plugin Code

Hi experts,

I'm currently working on integrating our legacy login system with VBulletin. As such, I've created a new plugin for the 'login_verify_success' hook. Next, I'm trying to set a few session variables that are needed by our other system. I'm running into troubles with accessing all the userinfo fields.

The below code works fine, and the session variable is set correctly. (Works for userid, usergroupid, membergroupid, infractiongroupids, username password, and salt)
PHP Code:
$_SESSION['userinfo']['username'] = $vbulletin->userinfo['username']; 


When I'm trying to access other values such as email or custom fields, the session variables remains empty. Is my syntax incorrect?
PHP Code:
$_SESSION['userinfo']['email'] = $vbulletin->userinfo['email']; 
I appreciate any advice. Please let me know if you need additional information.

Thanks!
Reply With Quote
  #2  
Old 02-10-2010, 09:41 PM
manu3569 manu3569 is offline
 
Join Date: Jan 2010
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does anybody know how to access the userinfo data structure in the plugin code section?
Reply With Quote
  #3  
Old 02-10-2010, 10:02 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not really familiar with that, but since no one else answered...I grep'ed for 'login_verify_success' and found it in includes/functions_login.php around line 149. Right above that some user data is read from the database, so I guess you could either modify that query to add the fields you need, or else do a similar query in your code. (Because, although I don't know, I'm guessing that at least some of those data items you want are not available unless you somehow get them from the db).
Reply With Quote
  #4  
Old 02-11-2010, 10:48 AM
manu3569 manu3569 is offline
 
Join Date: Jan 2010
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, the strange thing is if I do a print_r of the vbulletin datastructure, all the fields show up correctly (email, skype, aim, etc). But I can't seem to access them.

As a last resort, I can have an extra query for getting the data I need.

Thanks for your input.
Reply With Quote
  #5  
Old 02-11-2010, 11:20 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...after verify_authentication(), process_login() is called (also in function_login.php), and it looks like maybe that sets up the full $vbulletin->userdata. So maybe you can try moving your plugin to the login_process hook that's called at the end of process_login().
Reply With Quote
  #6  
Old 02-11-2010, 11:06 PM
manu3569 manu3569 is offline
 
Join Date: Jan 2010
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Case Close!

@kh99: Thanks a lot for this pointer. That's the right hook and all the data is available.
Reply With Quote
Reply


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 07:58 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.03742 seconds
  • Memory Usage 2,209KB
  • 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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete