Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-06-2008, 12:27 AM
sccrgy789 sccrgy789 is offline
 
Join Date: Feb 2007
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Probably a simple problem but... I need help.

I have a product which forms a variable in a plugin using the postbit_display_start hook:
PHP Code:
$someVar "whatever" $post[userid]; 
Then, I echo this string in my "postbit" using $someVar in the template.

This works completely fine and it echos and works properly.

However, when it comes to viewing a private message, it screws up. For some reason, when postbit_display_start executes, it ends up using the user id of the person VIEWING the PM, not of the person who the PM is from...

What I need is to basically have a string (for both viewing posts/threads AND for viewing PMs) which has the poster's/sender's user ID in it.
Reply With Quote
  #2  
Old 08-06-2008, 06:41 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can't you just put this in the template itself?
Code:
whatever$post[userid]
Reply With Quote
  #3  
Old 08-06-2008, 11:17 AM
sccrgy789 sccrgy789 is offline
 
Join Date: Feb 2007
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No because I'm using the userid to create an image path in the plugin.

For example:
PHP Code:
$imagePath $someOtherVar $post[userid] . ".jpg"
I just don't get why when the postbit hook is used for a post, $post[userid] is the poster's ID but when you use the hook for private messages, $post[userid] ends up being the currently logged in user viewing the PM.
Reply With Quote
  #4  
Old 08-06-2008, 12:44 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure why that would occur. Does
PHP Code:
$post['userid'
Work? Or:
PHP Code:
$post['fromuserid'
As a last resort check the PHP code in the file located around the hook it may give you clues as to which variable to use.
Reply With Quote
  #5  
Old 08-06-2008, 05:03 PM
sccrgy789 sccrgy789 is offline
 
Join Date: Feb 2007
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$post['userid'
is what i'm using and it only works for posts.

PHP Code:
$post['fromuserid'
would probably work but only for PMs.

I suppose if there's a way to determine whether a PM or Post is being viewed in the plugin, I could assign the proper variable.

BUT still: why is vBulletin using MY userid for $post['userid'] in the plugin and only for PMs? It doesn't really make any sense.
Reply With Quote
  #6  
Old 08-07-2008, 11:37 PM
sccrgy789 sccrgy789 is offline
 
Join Date: Feb 2007
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is still an issue... can anyone help?
Reply With Quote
  #7  
Old 08-08-2008, 12:09 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$post['fromuserid'] would not be set in a thread so use a conditional checking if a value is set for $post['fromuserid'] and use that id if it is and an else clause using the other if it is not set
Reply With Quote
  #8  
Old 08-08-2008, 09:40 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I really doubt vBulletin would load your UserID into the $post['userid'], are you sure you not viewing a PM you sent to yourself or something? (Look at the variable vBulletin uses when it links your username to the profile. It uses $post['userid'], maybe if you tried moving the hook to postbit_display_complete and used $this->post['userid'] ?).

If it still doesn't work post the full code you are using.
Reply With Quote
Reply


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:33 AM.


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.04127 seconds
  • Memory Usage 2,231KB
  • 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
  • (1)bbcode_code
  • (6)bbcode_php
  • (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