Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 09-21-2012, 04:34 PM
demo7up demo7up is offline
 
Join Date: Apr 2007
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 09-21-2012, 04:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It should be in $post['username'].
Reply With Quote
  #3  
Old 09-21-2012, 04:52 PM
demo7up demo7up is offline
 
Join Date: Apr 2007
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']
Reply With Quote
  #4  
Old 09-21-2012, 06:17 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #5  
Old 09-21-2012, 06:23 PM
demo7up demo7up is offline
 
Join Date: Apr 2007
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 09-21-2012, 06:36 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #7  
Old 09-21-2012, 06:36 PM
demo7up demo7up is offline
 
Join Date: Apr 2007
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 09-26-2012, 01:24 PM
demo7up demo7up is offline
 
Join Date: Apr 2007
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']
Reply With Quote
Reply

Thread Tools
Display Modes

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 07:04 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.05409 seconds
  • Memory Usage 2,219KB
  • 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
  • (7)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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