vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Accessing User Info in Plugin Code (https://vborg.vbsupport.ru/showthread.php?t=235259)

manu3569 02-07-2010 07:08 PM

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!

manu3569 02-10-2010 09:41 PM

Does anybody know how to access the userinfo data structure in the plugin code section?

kh99 02-10-2010 10:02 PM

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).

manu3569 02-11-2010 10:48 AM

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.

kh99 02-11-2010 11:20 AM

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().

manu3569 02-11-2010 11:06 PM

Case Close!

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


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

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.02922 seconds
  • Memory Usage 1,721KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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