vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Plugin needs email value at login. (https://vborg.vbsupport.ru/showthread.php?t=143156)

XXP 03-25-2007 09:43 PM

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!

MarkPW 03-25-2007 10:12 PM

At which hook are you executing your code exactly?

XXP 03-25-2007 10:23 PM

We're using the "login_verify_success" hook.

(Thanks for asking. I'll edit my post to show this too.)

MarkPW 03-25-2007 11:33 PM

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.

XXP 03-26-2007 01:37 AM

Quote:

Originally Posted by MarkPW (Post 1212306)
... 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".

Marco van Herwaarden 03-26-2007 06:46 AM

I suggest that you move to a hook location that is loaded later when the userinfo is available, if possible.

XXP 03-26-2007 11:43 AM

Quote:

Originally Posted by Marco van Herwaarden (Post 1212555)
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.

Marco van Herwaarden 03-26-2007 06:45 PM

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

XXP 03-28-2007 03:31 PM

Quote:

Originally Posted by Marco van Herwaarden (Post 1212996)
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.

Marco van Herwaarden 03-28-2007 05:33 PM

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


All times are GMT. The time now is 02:57 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.02712 seconds
  • Memory Usage 1,730KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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