vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Which Hook to access forumid / userid before display? (https://vborg.vbsupport.ru/showthread.php?t=169143)

smjChris 01-30-2008 07:40 AM

Which Hook to access forumid / userid before display?
 
Hello,

I have a script that places images (banners) where I choose, but for logging purposes I need to access the vBulletin $foruminfo['forumid'] & $bbuserinfo['userid'] variables.

I have placed the include file (through plug-in system) in global_start, and the images are displayed, but are missing the forumid / userid elements.

Which hook should I place my include into so I can access those variables and still be able to insert my output within the templates for display?

sample code of what I'm trying to do...

PHP Code:

//set userid = 0 for default/guest
$x_userID=0;
if (isset(
$bbuserinfo['userid'])){
    
$x_userID $bbuserinfo['userid'];
}

//build url for anchor
$myUrl "ad_Hit.php?";
$myUrl .= "adid=".$adArray['adid']."&uid=".$x_userID;

$myAnchor "<a href='".$myUrl."'><img src='".$imgPath."' border='0' hspace='3' vspace='3' alt='".$adArray['company']."'></a>"

constructed querystring is parsed in additional script and I need to log the userid if user is a registered user, not default of 0/guest


Thank you.

MarkPW 01-30-2008 02:57 PM

Quote:

I have placed the include file (through plug-in system) in global_start, and the images are displayed, but are missing the forumid / userid elements.
That's because they aren't available in global_start. Use global_setup_complete or even parse_templates ;)

Opserty 01-30-2008 03:51 PM

PHP Code:

$vbulletin->userinfo['userid'];
$forumid intval($_GET['f']); 


smjChris 01-30-2008 04:19 PM

I actually had tried it under both of those hooks and it did not work.

I think my major problem was an error in another function where I did not reference the global $x_userID variable where I was trying to store the userid.

I also used the $vbulletin->userinfo['userid'] pointer instead, then put it back into parse_templates hook and it works perfectly.

Thank you both. :up:


All times are GMT. The time now is 08:38 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.03528 seconds
  • Memory Usage 1,721KB
  • 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
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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