vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Variable for Username of the Person who posted the item. (https://vborg.vbsupport.ru/showthread.php?t=288124)

demo7up 09-21-2012 04:34 PM

Variable for Username of the Person who posted the item.
 
Im not sure if the title is suited for i what i need but here goes.

This Variable Returns the name of the logged in user

Code:

$vbulletin->userinfo['username']
Im building a postbit_legacy avatar plugin which I need to pull the USERNAME of each poster because depending on the posters users name it will display a unique avatar.

I hope someone understands me lol Thanks in advance.

kh99 09-21-2012 04:41 PM

It should be in $post['username'].

demo7up 09-21-2012 04:52 PM

returns null?

its in a vb plugin i should add.

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

I also tried for giggles

Code:

$vbulletin->post['username']
--------------- Added [DATE]1348252855[/DATE] at [TIME]1348252855[/TIME] ---------------

I need to equivalent version of

Code:

$post['username']
like this

Code:

$vbulletin->post['username']

kh99 09-21-2012 06:17 PM

There is no list of field in $vbulletin. If you really wanted to see what's there you could use print_r($vbulletin). But I don't think you'll find any "current post" fields in there.

What hook is your plugin using?

demo7up 09-21-2012 06:23 PM

Hook Location: Global_Start Plugin code This works well but shows my avatar instead of the avatar thats assigned to the posters username. The red has to be be the var that looks for the username of the postbit its being displayed in.

kh99 09-21-2012 06:36 PM

OK, the problem is that global_start is only called once. To display something in postbit_legacy for each poster you need to use a hook that's called once for each post, like postbit_display_complete.

For efficiency, you might want to create a global variable as a cache, so that if the same user has posted more than once on the page, you only have to do the work once. (But it might be a good idea to get it working before optimizing).

demo7up 09-21-2012 06:36 PM

i also tried threadbit_display &
Code:

$thread['postusername']
--------------- Added [DATE]1348256320[/DATE] at [TIME]1348256320[/TIME] ---------------

Code:

postbit_display_complete + $thread['postusername']
For the win works perfect thanks so much for your assistance

demo7up 09-26-2012 01:24 PM

Ok so heres an update.... the above code displays the username of the person who started the thread. KH99 you were correct with the right hook it works. I was using global_start instead of postbit_display_complete with the $post var.

Code:

postbit_display_complete + $post['username']


All times are GMT. The time now is 08:38 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.01099 seconds
  • Memory Usage 1,722KB
  • 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
  • (7)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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