View Full Version : Variable for Username of the Person who posted the item.
demo7up
09-21-2012, 04:34 PM
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
$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.
It should be in $post['username'].
demo7up
09-21-2012, 04:52 PM
returns null?
its in a vb plugin i should add.
--------------- Added 1348250142 at 1348250142 ---------------
I also tried for giggles
$vbulletin->post['username']
--------------- Added 1348252855 at 1348252855 ---------------
I need to equivalent version of
$post['username']
like this
$vbulletin->post['username']
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.
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 & $thread['postusername']
--------------- Added 1348256320 at 1348256320 ---------------
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.
postbit_display_complete + $post['username']
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.