Quote:
Originally Posted by kh99
It's kind of tricky selecting hooks just based on the name. Anyway, I would use postbit_display_complete instead of showpost_start.
You don't want to return from your plugin, because that could keep other plugins on the same hook from running. What you want to do is register your variable to the postbit template. Here's an article on rendering templates: https://vborg.vbsupport.ru/showthread.php?t=228078
But your code would be something like:
PHP Code:
global $vbulletin;
$fournisseur = $vbulletin->db->query_first("
SELECT telephone
FROM devis_fournisseurs
WHERE userid=$post[userid]
");
vB_Template::preRegister('postbit', array('telephone' => $fournisseur[telephone]));
You might also want to keep an array of userid => telephone and check that before doing a query, that way you won't have to query the same user more than once. Note that postbit_display_complete is called from inside a function, so you need to use a 'global' statement for any global variables you want to use.
|
Thank you kh, great article !
I had tried with preregister function, but had no success, so I tried the return with no more ...
I try again :up:
--------------- Added [DATE]1438595546[/DATE] at [TIME]1438595546[/TIME] ---------------
It works fine
Code:
global $vbulletin;
$fournisseur = $vbulletin->db->query_first("
SELECT telephone
FROM devis_fournisseurs
WHERE userid=$post[userid]
");
$telephone = $fournisseur[telephone];
vB_Template::preRegister('postbit_legacy', array('telephone' => $telephone));
But you said
Quote:
that way you won't have to query the same user more than once
|
Could ou help me with it ?
I tried recording in an array and check them with in_array but no success