vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Retrieving username / userid for widgit (https://vborg.vbsupport.ru/showthread.php?t=258499)

zushiba 02-07-2011 03:20 PM

Retrieving username / userid for widgit
 
Hey all. I am trying to write what should be an easy widgit using php but I'm struggling with finding out how to retrieve the username or userID.

I am trying to list forms the user has entered but to get to that point I need the users ID.

After searching and searching I find a lot of stuff for VB 3 that either no longer works or never worked. The last, simple code I found was
PHP Code:

ob_start();
$myusername =  $vbulletin->userinfo['username'];
echo 
$myusername;
$output .= ob_get_contents();
ob_end_clean(); 


But that outputs nothing. I tried looking through the VB4 articles but those seemed focused on creating templates and stuff, all of which is too big for what I'm trying to do and they STILL seem to leave out simple stuff like retrieving user info via php.

EDIT: Solved using the following code
PHP Code:

ob_start();
$myusername =  vB::$vbulletin->userinfo['username'];
echo 
$myusername;
$output .= ob_get_contents();
ob_end_clean(); 

required vB::

Lynne 02-07-2011 04:21 PM

I actually cover this here - Creating an HTML or PHP Widget

zushiba 02-07-2011 05:27 PM

Thank you this is an excellent resource. I didn't even think to look there.


All times are GMT. The time now is 10:27 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.00924 seconds
  • Memory Usage 1,718KB
  • 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
  • (3)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