vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Update Thread Title Global (https://vborg.vbsupport.ru/showthread.php?t=326051)

I.G.O.T.A. 02-02-2018 09:55 AM

Update Thread Title Global
 
We have a pretty big thread and the title needs to be changed for each post. Instead of doing it manually if you change the first post how do you update it globally?

Thank you,
JJ

I.G.O.T.A. 02-15-2018 06:04 PM

Anyone?

Inna 02-16-2018 07:52 AM

If no one else in that thread has chosen manual title (for example thread title is "how to", but my post which is the 3rd one in that thread titles "how not to", then either you should
1) do it manually
2) run a query in phpmyadmin to change all titles of posts of this specific thread

MarkFL 02-16-2018 10:36 AM

Create a plugin hooked at "threaddata_presave" with the code:

PHP Code:

global $vbulletin;

if (
$vbulletin->GPC['threadid'] == XXX)
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "post
        SET title = '" 
$vbulletin->db->escape_string($vbulletin->GPC['title']) . "'
        WHERE threadid = " 
$vbulletin->GPC['threadid'] . "
        AND parentid != 0
    "
);


Replace "XXX" with the threadid of the thread you want affected.

I.G.O.T.A. 02-18-2018 02:44 PM

Quote:

Originally Posted by MarkFL (Post 2592940)
Create a plugin hooked at "threaddata_presave" with the code:

PHP Code:

global $vbulletin;

if (
$vbulletin->GPC['threadid'] == XXX)
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "post
        SET title = '" 
$vbulletin->db->escape_string($vbulletin->GPC['title']) . "'
        WHERE threadid = " 
$vbulletin->GPC['threadid'] . "
        AND parentid != 0
    "
);


Replace "XXX" with the threadid of the thread you want affected.

Thanks!

Going to do this now.

--------------- Added [DATE]1518972702[/DATE] at [TIME]1518972702[/TIME] ---------------

Tried it and didn't work. Any idea what I did wrong?

MarkFL 02-18-2018 02:54 PM

Are you sure you used the correct thread id?

Before you saved the plugin, did you make it active?

I.G.O.T.A. 02-18-2018 02:58 PM

Quote:

Originally Posted by MarkFL (Post 2592974)
Are you sure you used the correct thread id?

Before you saved the plugin, did you make it active?

Yes, then I went and changed the title and it didn't update the other posts.

MarkFL 02-18-2018 03:00 PM

Odd...it worked for me.

I.G.O.T.A. 02-18-2018 03:01 PM

Quote:

Originally Posted by MarkFL (Post 2592976)
Odd...it worked for me.

It the thread ID just the number?

Is that the only thing to change?

MarkFL 02-18-2018 03:05 PM

Quote:

Originally Posted by I.G.O.T.A. (Post 2592977)
It the thread ID just the number?

Is that the only thing to change?

Can you post a link to the thread?

I.G.O.T.A. 02-18-2018 03:06 PM

The link is below friend.

https://www.igotacummins.com/threads...ustomer-Trucks

MarkFL 02-18-2018 03:08 PM

Quote:

Originally Posted by I.G.O.T.A. (Post 2592979)

Okay, what you should have is:

PHP Code:

global $vbulletin;

if (
$vbulletin->GPC['threadid'] == 10573)
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "post
        SET title = '" 
$vbulletin->db->escape_string($vbulletin->GPC['title']) . "'
        WHERE threadid = " 
$vbulletin->GPC['threadid'] . "
        AND parentid != 0
    "
);



I.G.O.T.A. 02-18-2018 03:10 PM

I have that, but if you look at all the titles after that they don't update.

MarkFL 02-18-2018 03:13 PM

Well, like I said that query works for me...don't know what issue there is at your site preventing it from running.

I.G.O.T.A. 02-18-2018 03:18 PM

1 Attachment(s)
Quote:

Originally Posted by MarkFL (Post 2592982)
Well, like I said that query works for me...don't know what issue there is at your site preventing it from running.

Yes, that is very strange.

Thanks for the help. I will see if I can figure this out as I do have a PHP error.

Attachment 156945

I.G.O.T.A. 02-18-2018 03:22 PM

Just turned off all the plugins to see if it would update and nothing.

So strange...

MarkFL 02-18-2018 03:29 PM

If you turned off all plugins (disabled hooks), then this new plugin won't run.

I.G.O.T.A. 02-18-2018 05:50 PM

Quote:

Originally Posted by MarkFL (Post 2592985)
If you turned off all plugins (disabled hooks), then this new plugin won't run.

I didn't do it globally, just one at a time.

MarkFL 02-18-2018 05:53 PM

I would first try turning off any plugins hooked at the same location.

I.G.O.T.A. 02-19-2018 12:39 PM

Quote:

Originally Posted by MarkFL (Post 2592991)
I would first try turning off any plugins hooked at the same location.

I will try that.

Thank you, sir.

--------------- Added [DATE]1519051345[/DATE] at [TIME]1519051345[/TIME] ---------------

So just tried and it didn't work.

We are talking about the RE: Title correct?

MarkFL 02-19-2018 01:33 PM

I'm talking about all plugins whose hook location is "threaddata_presave."

I.G.O.T.A. 02-19-2018 02:38 PM

Quote:

Originally Posted by MarkFL (Post 2593011)
I'm talking about all plugins whose hook location is "threaddata_presave."

Yep, I did that.

So let me walk through this one more time.

First I create a plugin hooked at "threaddata_presave" with the code:

global $vbulletin;

if ($vbulletin->GPC['threadid'] == XXX)
{
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "post
SET title = '" . $vbulletin->db->escape_string($vbulletin->GPC['title']) . "'
WHERE threadid = " . $vbulletin->GPC['threadid'] . "
AND parentid != 0
");
}

Using my ID number which is 10573 in the XXX

Next, I go to the thread and update the title and hit save. The title changes, but only the main one which is my issue, not all the rest of the posts.

Is that correct sir?

MarkFL 02-19-2018 02:43 PM

For whatever reason that plugin is not executing...have no idea why...it works perfectly for me.

I.G.O.T.A. 02-19-2018 02:52 PM

I have an idea, brb.

--------------- Added [DATE]1519059557[/DATE] at [TIME]1519059557[/TIME] ---------------

GOT IT! ;)

Thank you!!!

MarkFL 02-19-2018 03:26 PM

Quote:

Originally Posted by I.G.O.T.A. (Post 2593015)
I have an idea, brb.

--------------- Added [DATE]1519059557[/DATE] at [TIME]1519059557[/TIME] ---------------

GOT IT! ;)

Thank you!!!

The post merging here is a real PITA...the only way I knew you had posted another reply was to check, as it does not show up as a new reply.

Anyway, what was causing the plugin not to execute?

I.G.O.T.A. 02-19-2018 04:28 PM

Our server was on fast CGI and we kept hitting limits which cause errors and issues.

Once I changed us back to just regular CGI my errors went away and everything worked. ;)

Thanks, friend,
JJ

Stratis 02-20-2018 11:51 AM

I tested this plugin in my dev site, to work I disabled the "fast CGI"

Is there a way Mark... to the second post title and so on until last post to have the word "Re" before the title
or what else we use?

Thanks

MarkFL 02-20-2018 04:43 PM

Just change the query to this:

PHP Code:

    $vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "post
        SET title = 'Re: " 
$vbulletin->db->escape_string($vbulletin->GPC['title']) . "'
        WHERE threadid = " 
$vbulletin->GPC['threadid'] . "
        AND parentid != 0
    "
); 


Stratis 02-21-2018 03:47 AM

Ok thanks Mark , some times i get an error
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; modpm_checker has a deprecated constructor...

MarkFL 02-21-2018 04:26 AM

Quote:

Originally Posted by Stratis (Post 2593039)
Ok thanks Mark , some times i get an error
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; modpm_checker has a deprecated constructor...

That has nothing to do with the query I posted...sounds like an add-on. :)

Stratis 02-21-2018 05:34 AM

Ok, i will see, actually i tested in my dev site, thanks for another time.


All times are GMT. The time now is 04:15 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.01349 seconds
  • Memory Usage 1,800KB
  • 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
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (31)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