vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Cannot get username (https://vborg.vbsupport.ru/showthread.php?t=266872)

LjTiger69 07-15-2011 10:45 AM

Cannot get username
 
Hello, I'am new in VB4.
I try to create a plugin that add a field in postbit for showing a score from a game. This field is stored in a custom table in db.
This is code for plugin:

Code:

$name = $vbulletin->userinfo['username'];
$sql = "SELECT * FROM record WHERE Nome='$name'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

if ($row[Record])
{
    $template_hook['postbit_userinfo_right_after_posts'] .= '<dt>Score</dt> <dd>' .$row[Record]. '</dd>';
}

Problem is that $name return ""
How can get the username?

nhawk 07-15-2011 11:03 AM

Try including..

Code:

global $vbulletin;
As the first line in your plugin code.

LjTiger69 07-15-2011 11:08 AM

Thanks now work

--------------- Added [DATE]1310732424[/DATE] at [TIME]1310732424[/TIME] ---------------

Yes now work but $name return my username, not the username of author of thread. How can get the username of author of thread?

--------------- Added [DATE]1310734332[/DATE] at [TIME]1310734332[/TIME] ---------------

OK, I have solved using varible $post[userid]


All times are GMT. The time now is 11:39 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.01664 seconds
  • Memory Usage 1,709KB
  • 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_code_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