Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-14-2015, 09:34 AM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [hook] grabbing userid

first what im trying to do: I want to be able to grab the userid and show it in the forumhome_lastpostby template.

what ive got so far: i have created a plugin at forumbit_display:
Code:
$username = $lastpostinfo[lastposter];
$lastposter = $vbulletin->db->query_first("SELECT userid FROM ". TABLE_PREFIX ."user WHERE username = \"$username\"");
so its grabbing the last posters username, and looking for their id in the DB then displaying when i use
Code:
$lastposter[userid]
the problem is, it's not quite working =(

i get a result that shows on one of my forums, but the rest are blank.
*note i have removed everything from the lastpostby template and only have $lastposter[userid]*

dont mind the theme, just something im finally bringing to life, but where i have circled their should be userids, topmost should be a 2 and the other missing one a 1 for my id.

*note 2* this way does work on the forumbit templates properly but i would much rather have it in the lastpostby template
so its a matter of what hook im assuming, and i've cycled through a majority of them and none seem to do it =/
Attached Images
File Type: png Capture.PNG (54.6 KB, 0 views)
Reply With Quote
  #2  
Old 02-14-2015, 10:48 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...I don't know why that isn't working. Maybe you can also display the username to see if that's valid. Also you probably need to use $vbulletin->db->escape_string() on the username in case it contains special characters (although it seems unlikely that that's the problem here).

I think you might be able to do this without a query. I guess lastpostinfo is built instead of getting it directly from $forum because categories want to be able to display the latest info from a child? But all the poster info including the userid is already in the $vbulletin->forumcache[] array, so if you searched that array (or the current forum and it's children) for $vbulletin->forumcache[X]['lastposter'] == $lastpostinfo[lastposter], then you could just use $vbulletin->forumcache[X]['lastposterid'].

But I guess that doesn't necessarily fix the problem you're having.
Reply With Quote
  #3  
Old 02-14-2015, 12:37 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i actually ended up leaving this as is and worked with it, i guess i can handle it being in the forumbits lol.

but i moved on to phase 2 of this and i actually got help with that part from another one of your posts, but somethings wrong again lol, i made anther post over here
https://vborg.vbsupport.ru/showthread.php?t=317330
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 08:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03684 seconds
  • Memory Usage 2,193KB
  • Queries Executed 14 (?)
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
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (1)postbit_attachment
  • (3)postbit_onlinestatus
  • (3)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_postinfo_query
  • fetch_postinfo
  • 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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete