Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
  #1  
Old 08-08-2019, 09:07 PM
vbSuperfan vbSuperfan is offline
 
Join Date: Jun 2019
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to access vBulletin session info from other PHP applications on the same domain?

I coding a small, simple light-weight PHP application (that is, I would like to avoid having to make it a full fledged "product"/plugin for vBulletin 5 Connect at this point) which must access the userid (and subsequently, username and usertitle) of the currently logged-in user in the vBulletin 5 Connect instance that is running on the same domain (that is, my PHP app will have access to the cookies of this vBulletin instance too).

My question is, what would be the simplest and most efficient way to get hold of this currently-logged-in-user-in-vBulletin information from this stand-alone PHP application of mine?

I'm guessing that the vBulletin user-sessions are not written to the database, but rather only using some kind of "memory only" PHP session kind of thing, which in turn would prevent me from using a database-only solution where all the above-mentioned information could be resolved directly from the vBulletin database by my application (based on initially looking up the session ID found in the vBulletin cookies etc), right?

Is there any good summarized info available for vBulletin 5 Connect for this kind of "Single Sign-On" functionality that anyone here knows of?

During my googling, I only managed to find similar info applying to vBulletin 3 (e.g. here), which I've heard has a very different user session handling than vBulletin 5 Connect though?

Any hints of any kind would be highly appreciated!
Reply With Quote
  #2  
Old 08-09-2019, 02:00 AM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That could be help and is the only one I know:
https://forum.vbulletin.com/blogs/da...n-your-website
Reply With Quote
  #3  
Old 08-09-2019, 06:37 PM
vbSuperfan vbSuperfan is offline
 
Join Date: Jun 2019
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your reply!

I've seen that article when googling this, but as far as I can see, you must authenticate with a username and password before you can use any API:s at all like that, which would defeat the purpose of this method entirely for what I'm looking for (which could be described as the "reverse" of what that article is about), or am I misunderstanding something here?

This "autoloader.php" only provides access to the vB5 API, right?

Where can I find a good documentation for the vB5 API by the way, anyone knows?
Reply With Quote
  #4  
Old 08-09-2019, 09:50 PM
shka shka is offline
 
Join Date: Mar 2016
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good? I don't know. But there is http://vb5support.com/resources/api/
Reply With Quote
  #5  
Old 08-22-2020, 11:52 AM
ART's Avatar
ART ART is offline
 
Join Date: Feb 2002
Location: Opole, Poland
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by vbSuperfan View Post
I coding a small, simple light-weight PHP application (that is, I would like to avoid having to make it a full fledged "product"/plugin for vBulletin 5 Connect at this point) which must access the userid (and subsequently, username and usertitle) of the currently logged-in user in the vBulletin 5 Connect instance that is running on the same domain (that is, my PHP app will have access to the cookies of this vBulletin instance too).

My question is, what would be the simplest and most efficient way to get hold of this currently-logged-in-user-in-vBulletin information from this stand-alone PHP application of mine?
!

This is working for me (vb562 using vb API) look below. When calling the API the currently logged in user session also gets updated The sessions are stored in the database (prefix_session)

PHP Code:
// Path to your vBulletin installation
$vbpath 'xxxxxx';

define('CSRF_PROTECTION'false);
require_once(
$vbpath '/includes/vb5/autoloader.php');
vB5_Autoloader::register($vbpath);
vB5_Frontend_Application::init('config.php');

$userid vB::getCurrentSession()->get('userid'); 
$user_info vB_User::fetchUserinfo($userid0falsefalse); 
Now You could grab the usertitle from $user_info array
$user_info['usertitle']
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:48 AM.


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.06470 seconds
  • Memory Usage 2,198KB
  • Queries Executed 11 (?)
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
  • (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
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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