Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2015, 07:50 AM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Unable to calculate $steam_id ($steam_info) sooner for use in PHP plugins (final req)

It's the final thing I really need help on, as I can't figure this out on my own (after really days of playing around with the code). I'll make it as simple as possible.

Oke, here we go. This, is login2.php from the steam plugin made by Disasterpiece

Code:
http://pastebin.com/nrn1ZxKz
Coding it, so the pastebin won't be listed for guests. (its unlisted, not public).

Now, see line 197, you'll see the following hook:
Code:
($hook = vBulletinHook::fetch_hook('stc_linkuser_complete')) ? eval($hook) : false;
I'm trying the following plugin, hooked to that hook mentioned above:

Code:
// One time check for Steam-linked Validation Users //

// vBulletin Group Movement API
$dataman =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$dataman->set_existing($vbulletin->userinfo); 

// Steam Level Information API
$steam_id = get_user_steamid($stc_userinfo);
$steam_info = fetch_steam_info($steam_id, $vbulletin->options['stc_apikey']);

if (!empty($vbulletin->userinfo['steam_link']) AND (!empty($steam_info['EconomyBan']) AND $steam_info['EconomyBan'] == banned AND $vbulletin->userinfo['usergroupid'] == 49))
{
$dataman->set('usergroupid', 40);
$dataman->save();
}
The idea is simple. Check $steam_info['EconomyBan'] and see if the user is banned in it. The problem is however, that $steam_info is not yet available for the hook/plugin to use but only a few micro-seconds after the page reloads saying that the steam link has succeeded. Now, according to kh99 he mentioned to use the following values:

Code:
$vbulletin->db->escape_string($steam_id).'|0|0'  
calc_steam_code($steam_id)
But no matter where I place them, in the plugin, even add ; at the end of each.. I can't get $steam_info to work.

Now, on line 183 and 184, the steam_id is being calculated and after the complete hook saved. So I thought, lets save it sooner by adding:

Code:
$userdata_rank->save();
on line 185. But no luck, steam_info is still not available when my plugin on the hook is being executed.

So, I was wondering if someone could help me out with this final thing. I've included as much information as I could. It is possible that the steam_info is being filled after handle user authenticated (line 220), but I'm unsure. Especially because on line 279 it says to be excluded on user linking.
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 02:11 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.06809 seconds
  • Memory Usage 2,158KB
  • 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
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)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