vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Custom profile fields in postbit, the lazy way (https://vborg.vbsupport.ru/showthread.php?t=91234)

Chris M 06-28-2005 08:22 AM

Custom profile fields in postbit, the lazy way
 
PHP Code:

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 [high]postbit_display_complete[/high] 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

Quote:

Originally Posted by KirbyDE
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 [high]showthread_start[/high] 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

PHP Code:

$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

Quote:

Originally Posted by hellsatan
Hehe - In the end I used the [high]showthread_start[/high] 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

Quote:

Originally Posted by KirbyDE
PHP Code:

$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:

PHP Code:

$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.


All times are GMT. The time now is 01:33 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01085 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete