vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Replace char in thread title (class_dm_threadpost) (https://vborg.vbsupport.ru/showthread.php?t=215344)

charlie71 06-04-2009 05:11 PM

Replace char in thread title (class_dm_threadpost)
 
Hi,
i want to replace single characters from thread titles in specific forums only.

i've added a small piece of code

Code:

               
        function verify_title(&$title)
        {
                // replace html-encoded spaces with actual spaces
                $title = preg_replace('/&#(0*32|x0*20);/', ' ', $title);
                if($foruminfo['forumid'] == '31' or $foruminfo['forumid'] == '114' or $foruminfo['forumid'] == '32') {
                $title = preg_replace('/[\.]/', ' ', $title);
                $title = preg_replace('/[\-]/', ' - ', $title);
                $title = str_replace("  ", " ", $title);
                }


                $title = trim($title);

in class_dm_thread_post.php (line 111), but it seems that $foruminfo is empty.
how to get the forumid in class_dm_thread_post? Any idea?

cheers

Dismounted 06-05-2009 05:34 AM

The forumid would be contained in:
PHP Code:

$this->info['forum']['forumid'


Fluke667 10-25-2012 03:19 AM

I need do same

How this work exactly? Can any1 Help me?

I want remove - and _ on specific forums...

kh99 10-27-2012 09:47 PM

The OP has edited the file class_dm_threadpost.php and inserted the code in bold into the function verify_title() where shown (it still looks like it's around line 110). But you also need to use $this->info['forum']['forumid'] instead of $foruminfo['forumid'], so maybe like this:

Code:

        function verify_title(&$title)
        {
                // replace html-encoded spaces with actual spaces
                $title = preg_replace('/&#(0*32|x0*20);/', ' ', $title);

                if (in_array($this->info['forum']['forumid'], 1, 2, 3)) {
                      $title = preg_replace('/[\.]/', ' ', $title);
                  $title = preg_replace('/[\-]/', ' - ', $title);
                  $title = str_replace("  ", " ", $title);
                }

                $title = trim($title);


Of course you'd replace 1, 2, 3 with the list of one or more forum ids where you want those characters removed.


All times are GMT. The time now is 01:34 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.01019 seconds
  • Memory Usage 1,717KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete