vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Probably a simple problem but... I need help. (https://vborg.vbsupport.ru/showthread.php?t=187331)

sccrgy789 08-06-2008 12:27 AM

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.

Dismounted 08-06-2008 06:41 AM

Can't you just put this in the template itself?
Code:

whatever$post[userid]

sccrgy789 08-06-2008 11:17 AM

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.

Opserty 08-06-2008 12:44 PM

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.

sccrgy789 08-06-2008 05:03 PM

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.

sccrgy789 08-07-2008 11:37 PM

This is still an issue... can anyone help?

RLShare 08-08-2008 12:09 AM

$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

Opserty 08-08-2008 09:40 AM

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.


All times are GMT. The time now is 09:13 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,728KB
  • 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
  • (1)bbcode_code_printable
  • (6)bbcode_php_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