Extra table, understanding XF vs VB


Active member
I have an additional field "playerID" in table threads.
I have an additional table "Players" with ID and Playername.
I want to show the name of a player above every thread that fits to this player.

In VB i solve it like this:

1. showthreads.php takes data from my thread.

2. With the playerid x i fetch the row like
select playername from table players where players.id = threads.playerid

3. I show the name with a new variable in template showthreads.

We dont talk about details or real names, just about this known, made and easy way with VB.

With XF i have now clue how to do it and so i ask for the big picture not for the programing itself, please.

We need a hook?
We need a listener connected to this hook? Means we have a function that sends data to the running script just at this point where the hook is?
We need a class that takes the playerid and fetch my row from table players? It is called when the hook is reached and passes my playername to the listener and with this to an array of data we can use in a template?
So we add players.playername to array threads for example?
We need to pass something like threads.playername in the right template?
Last edited:
I wouldn't use the external DB or PHP file, this can be done much simpler.

You can add a custom user field on this page:

Add the custom field "playerID" to XenForo.

You'll need to run a MySQL query to transfer the player IDs from your DB to the xenforo one, but that should be pretty simple.

Once that's done, the playerID should be available in your templates, you can print it out like this:

You'll probably want to addd it somewhere to the "Post" or "Message" templates.

Good Luck!


Active member
Thank you for this advice, but i really want to do it like described. It is 1. an example for me to learn and 2. a needed part of my new project to use a board and my player-database.

Unfortunately i dont understand XF, unfortunately there is no documentation.

I have build the whole project now with VB3.8 in two days and try to find a programer here in germany to do the same with XF, while trying to understand XF.