The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Problem writing a threadbit plugin
Hi, I'm trying to program a simple plugin to change the info shown in the author field of the threadbit in certain forums, yet I'm encountering a very silly problem.
Maybe it's not the best practice but what I did was set a placeholder comment in the template where the desired condition is met, which is then replaced with the plugin (when I only make changes in the template everything works fine, but I need to use PHP), I'll try to optimize it when I get it to work. So as a very simple test, I tried to show the thread title again in the author field, this is the plugin right now: Code:
if ($thread['forumtitle']=='Logros') { $origen1="<!-- Logro_Descripcion -->"; $destino1="<div class='author'>".$thread['threadtitle']."</div>"; $threadbit=str_replace($origen1,$destino1,$threadbit); } The $thread variable seems to be picking the data from the NEXT thread. It works fine when I set in the template to show the threadtitle instead of the author there but my intentions is to use the php function to explode the thread[preview] string and show part of it in the author field and replies field. I hope it was a clear explanation. Could someone explain to me why is this happening and what could I do? Thanks. |
#2
|
||||
|
||||
You're doing a string replace on a template that hasn't been rendered for the currently thread yet. Your'e doing a string replace on it when you are into the next threadid iteration which is why it is doing what it's doing.
If you just want to add something into the current threadbit, then just define something like: PHP Code:
HTML Code:
{vb:raw thread.my_var} |
#3
|
|||
|
|||
Great, works like a charm now, thanks a lot
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|