View Full Version : Custom profile fields in postbit, the lazy way
Chris M
06-28-2005, 08:22 AM
global $vbulletin;
$vbulletin->templatecache['postbit'] = str_replace('$post[usertitle]','$post[usertitle]<br />$post[field10]',$vbulletin->templatecache['postbit']);
I tried to use the code above using the postbit_display_complete hook to make a user's custom title (profilefield field10) show below their standard user title...
The problem is that although it works, post one has:
usertitle
custom title
However, post two, three, four etc have:
usertitle
custom title
custom title
custom title
... etc ... etc ...
Any way around this so I can get it to display only once per post? :)
Satan
Andreas
06-28-2005, 08:52 AM
Use another Hook that gets only called once.
Btw: Cool idea! This way one could even cut-down on Template edits :)
Chris M
06-28-2005, 08:57 AM
Use another Hook that gets only called once.
Btw: Cool idea! This way one could even cut-down on Template edits :)
Hehe - In the end I used the showthread_start hook - Works perfectly now :)
It is a good idea, especially if you don't want to have to make lots of edits to templates for every upgrade :)
Satan
Johannes de Le?n
07-26-2005, 01:56 PM
How does one change multiple lines in a template?
I've tried creating variables, arrays, inserting the whole thing in str_replace (between ' '), but nothing worked...
Andreas
07-26-2005, 02:00 PM
$vbulletin->templatecache['templatename'] = str_replace(array('search1', 'search2', 'search3'), array('replace1', 'replace2', 'replace3'), $vbulletin->templatecache['templatename']);
If that is what you want ...
Boofo
07-26-2005, 02:37 PM
Hehe - In the end I used the showthread_start hook - Works perfectly now :)
It is a good idea, especially if you don't want to have to make lots of edits to templates for every upgrade :)
Satan
Do you have the plug-in made for this then so I can use it? ;)
Christine
07-26-2005, 02:40 PM
I missed a pretty cool thread. Thanks for bumping this back into the New Posts listing.
:)
Boofo
07-26-2005, 02:41 PM
You owe me! ;)
Johannes de Le?n
07-26-2005, 03:59 PM
$vbulletin->templatecache['templatename'] = str_replace(array('search1', 'search2', 'search3'), array('replace1', 'replace2', 'replace3'), $vbulletin->templatecache['templatename']);
If that is what you want ...
I wanted something like:
$x = 'everything
I
want
replaced
here';
$x_1 = 'everything
I
want
to
replace
here';
$vbulletin->templatecache['templatename'] = str_replace($x, $x_1, $vbulletin->templatecache['templatename']);
But it doesn't work...
Thanks for the help, anyway. :)
Andreas
07-26-2005, 04:57 PM
Erm ... that should work just fine.
Erwin
07-29-2005, 11:56 AM
Very cool - I was doing this with vB3 using a weird method but this simplifies things tremendously.
Chris M
07-29-2005, 10:15 PM
Do you have the plug-in made for this then so I can use it? ;)
I can plugin it up and release it later on for you Bob :)
Satan
Boofo
07-29-2005, 10:16 PM
I can plugin it up and release it later on for you Bob :)
Satan
Sounds good. Later on ... meaning when? ;)
Johannes de Le?n
07-31-2005, 12:16 PM
I am highly interested, as well.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.