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 03-25-2007, 10:43 PM
XXP XXP is offline
 
Join Date: Jan 2007
Location: Upstate NY
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugin needs email value at login.

We're switching to using vB (3.6.x) login across our site.

We have a plugin that is issuing a cookie for a legacy system but need to get the user's email address for it.

$vbulletin->userinfo['email'] doesn't seem to be loaded at this point (the "login_verify_success" hook).

I can hack the verify_authentication routine to load email in there but would rather not mod the core code. Is ther any other way to get it?

Thanks!
Reply With Quote
  #2  
Old 03-25-2007, 11:12 PM
MarkPW MarkPW is offline
 
Join Date: Apr 2006
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

At which hook are you executing your code exactly?
Reply With Quote
  #3  
Old 03-25-2007, 11:23 PM
XXP XXP is offline
 
Join Date: Jan 2007
Location: Upstate NY
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We're using the "login_verify_success" hook.

(Thanks for asking. I'll edit my post to show this too.)
Reply With Quote
  #4  
Old 03-26-2007, 12:33 AM
MarkPW MarkPW is offline
 
Join Date: Apr 2006
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've had a look and I think you'll have to edit the SQL for this one, unless you don't mind making an extra query in your hook to fetch the e-mail address.
Reply With Quote
  #5  
Old 03-26-2007, 02:37 AM
XXP XXP is offline
 
Join Date: Jan 2007
Location: Upstate NY
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkPW View Post
... you'll have to edit the SQL for this one, unless you don't mind making an extra query in your hook ....
Yeah, thanks; that's what it looks like to me too. I simply added "email" to the query in the "verify_authentication" function in "functions_login.php" and it loads $vbulletin->userinfo['email'] just fine.

It'd be swell if 'email' was in that query anyway. I'd sure prefer not to modify the base code but, as you say, better that then to do a whole new extra query.

Thanks again for your replies. I'm still hoping that someone else may know another place where the value has been loaded but suspect that this is "the way".
Reply With Quote
  #6  
Old 03-26-2007, 07:46 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I suggest that you move to a hook location that is loaded later when the userinfo is available, if possible.
Reply With Quote
  #7  
Old 03-26-2007, 12:43 PM
XXP XXP is offline
 
Join Date: Jan 2007
Location: Upstate NY
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marco van Herwaarden View Post
I suggest that you move to a hook location that is loaded later when the userinfo is available, if possible.
Thanks for this Marco. I looked around for other possible hooks but I think that this is the only one that will work for us. If you know of a better one for us I'd truly appreciate it if you could post it's name here.

We need it to get called immediately after successful logon and without depending on going to a vB page other than the "success" redirect page.

What we're expecting to do is actually have legacy board logon go to the vB logon and return the users to the legacy system after success. The legacy system keeps the email address in the session cookie so that the database doesn't have to be hit again for it on post, etc.

Thanks again. It looks like the small code mod to add "email" to the base query is the way to do it.
Reply With Quote
  #8  
Old 03-26-2007, 07:45 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could try global_start. It is executed in global.php after the userinfo is loaded.

Otherwise the following article might be usefull to find a better location: https://vborg.vbsupport.ru/showthread.php?t=94338
Reply With Quote
  #9  
Old 03-28-2007, 04:31 PM
XXP XXP is offline
 
Join Date: Jan 2007
Location: Upstate NY
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marco van Herwaarden View Post
You could try global_start. It is executed in global.php after the userinfo is loaded.
https://vborg.vbsupport.ru/showthread.php?t=94338
Hi & Thanks.

I looked at this and it comes too late for our purposes but it does bring up a question about user session management.

It looks like the system is doing a new query (or set of queries) whenever it needs to know the user info. My question is: why isn't this just loaded into a (single) cookie that can be used for userdata reference instead of re-hitting the database?

The cookie could be timestamped for a freshness check and it can also be refreshed or completely re-issued from time to time -- like whenever a user does something significant. Using the cookie more and the database less might be a good thing.

Hope this is a useful thought.
Reply With Quote
  #10  
Old 03-28-2007, 06:33 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I doubt that would be very usefull for a few reasons:
- Cookies could be manipulated (ok, there could be a checksum, but if the algorithm gets public, that is useless)
- The userinfo can be changed between the time the cookie was created and the time the user browse the board. Imagine you ban someone and it wil only take effect once his cookie timeout.
- ....
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 12:05 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.04707 seconds
  • Memory Usage 2,245KB
  • 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_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (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_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