Log in

View Full Version : Thread title first character uppercase


Andy
07-15-2005, 06:07 PM
I like to see the thread title always start with an uppercase. I was able to figure out how to do this in newthread.php

In v3.5.0 beta 4 I added to line 133 this code...


$newpost['title'] = strtoupper($newpost['title']{0}).substr($newpost['title'], 1);


However I also need to add a similar code to the editpost.php file. I tried many things but was not able to do it.

Can someone who understands editpost.php better take a look and see where I can add code to make edited thread titles always start with an uppercase character.

Thank you. :)

Christine
07-15-2005, 10:24 PM
Just at a quick glance, but take a look around line 387 $threadman->set('title', unhtmlspecialchars($edit['title'])); If I am reading that right, that routine should edit the title of the thread if the post being edited is the first post.

Andreas
07-16-2005, 01:05 AM
*** Untested ***

Hookname: threadfpdata_presave

$this->thread['title'] = ucfirst($this->thread['title']);
$this->post['title'] = ucfirst($this->post['title']);


Hookname: postdata_presave

if ($this->existing['postid'] == $this->info['thread']['firstpostid'])
{
$this->post['title'] = ucfirst($this->post['title']);
}


Hookname: threaddata_presave

$this->thread['title'] = ucfirst($this->thread['title']);


This should take care of Thread Titles, no matter where they are being set/edited.

Christine
07-16-2005, 01:36 AM
Hi Andy,

You may want to remove the code edits and try Kirby's suggestions. If what he is thinking will work, then it will be 2 less files that you have to fiddle with on upgrades.

Personally, I can't wait until I have a handle on the new plugin system. I am still in find-code-modify-code mode. :p

Andy
07-16-2005, 01:43 AM
Thank you Christine for your time. :)

Kirby your awesome, that worked perfect. :) :up:

Christine
07-16-2005, 01:52 AM
Andy,

No problem. Don't know why you deleted your post, but don't forget to take out the code edits you made. That would be a Christine move. Heh.

Andy
07-16-2005, 02:12 AM
Hi Christine,

The Automerged Doublepost hack had me all confused. What PITA that is, people should be able to post twice in a row.

Andreas
07-16-2005, 02:13 AM
What PITA that is, people should be able to post twice in a row.
Sorry, but I have to disagree strongly :)
People posting several times in a row are a PITA!

Prevent Doubleposting is one of the best Hacks ever.

Andy
07-16-2005, 02:15 AM
*** Untested ***

Hookname: threadfpdata_presave

$this->thread['title'] = ucfirst($this->thread['title']);
$this->post['title'] = ucfirst($this->post['title']);


Hookname: postdata_presave

if ($this->existing['postid'] == $this->info['thread']['firstpostid'])
{
$this->post['title'] = ucfirst($this->post['title']);
}


Hookname: threaddata_presave

$this->thread['title'] = ucfirst($this->thread['title']);


This should take care of Thread Titles, no matter where they are being set/edited.

There is a bug in this code. If a users posts a new posts to the thread, the thread title changes to a "0".

Andreas
07-16-2005, 02:23 AM
Great that I labeled it untested :D

Hookname: threaddata_presave

if ($this->thread['title'])
{
$this->thread['title'] = ucfirst($this->thread['title']);
}

merk
07-16-2005, 02:57 AM
Sorry, but I have to disagree strongly :)
People posting several times in a row are a PITA!

Prevent Doubleposting is one of the best Hacks ever.

Not when people are replying to specific posts.

I still believe that you should be able to reply to specific posts, not forcing you to "automerge" 2 posts.

Andy
07-16-2005, 03:47 AM
Not when people are replying to specific posts.

I still believe that you should be able to reply to specific posts, not forcing you to "automerge" 2 posts.

I agree with Merk.

I really dislike the "automerge" function. What is the logic behind it? Is it suppose to save space? When was this hack implemented?

----------------------------------------------------------------
New post starts here

Great that I labeled it untested :D

Hookname: threaddata_presave

if ($this->thread['title'])
{
$this->thread['title'] = ucfirst($this->thread['title']);
}


Great work Kirby, looks like that did the trick. No problems over the past hour of testing.

Thanks again for your time. :)

Christine
07-16-2005, 04:22 AM
Actually, I like auto merge for 90% of the time because of bumps, but I heartily agree about responding to posts.

My comments were in response to a post prior to mine (since deleted) that made my post look like a loon out of place talking to thin air -- not a response to a merged post that came after me.

;)

Andy
07-16-2005, 05:28 AM
Actually, I like auto merge for 90% of the time because of bumps, but I heartily agree about responding to posts.



Yes I forgot about the "bumping" problem, that is why the automerge was developed. It's a shame a few have to ruin it for the rest, perhaps those that bump should be put into a "special" user group and the automerge would only merge their posts.

Andy
08-28-2005, 09:12 PM
Hi Kirby,

I have been testing your plugin more carefully and it looks like threadfpdata_presave is not required.

Thanks again for a great plugin. :)