The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Display the result of a query in postbit
Hi all,
I'm wanting to display in the postbit, the result of a query but that doesn't work and I don't understand why. So, this is my table fournisseurs : SC1 Here is where I want to display its phone number (alt of the img) : SC2 This is the hook I added for showpost_start : PHP Code:
And this is the little part that displays the phone picture and should display the number, but it doesn't Code:
<vb:if condition="$post[usergroupid]==10 || $post[usergroupid]==11"> <img src="images/smilies/telephone.png" alt="test {vb:raw telephone}"></vb:if> Thank you:up: |
#2
|
|||
|
|||
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:
|
#3
|
||||
|
||||
Quote:
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:
I tried recording in an array and check them with in_array but no success |
#4
|
|||
|
|||
What I meant is something like this:
PHP Code:
But I remembered a better way that might work without adding a query. You can add on to the existing post query in showthread.php using a plugin on hook showthread_query_postids and code like this: PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|