How to Make the Blog Title Accept More than 32 Characters in SocialEngine 4
Written by Andrew Cross Friday, 14 December 2012
Here’s a little tutorial on how to change from the default 32 characters in blog title to a larger value , say 64.
By default , in SE 4.1.4 a blog title can have a maximum of 32 characters , and if a title with more than 32 characters is entered , it will be accepted , but when viewing the blog , the title will be truncated to 32 characters.
To fix this (and also for the forum ) do the following :
Edit this —-
application\modules\Blog\Model\Blog.php
around line 80
public function getSlug()
{
$str = $this->getTitle();
if( strlen($str) > 32 ) {
$str = Engine_String::substr($str, 0, 32) . '...';
}
$str = preg_replace('/([a-z])([A-Z])/', '$1 $2', $str);
$str = strtolower($str);
$str = preg_replace('/[^a-z0-9-]+/i', '-', $str);
$str = preg_replace('/-+/', '-', $str);
$str = trim($str, '-');
if( !$str ) {
$str = '-';
}
return $str;
}
And change the 32 limit to something like 64 or any value of your liking.
Save and you are done.
To make this work for Forum topic , then edit the
/application/modules/Core/Model/Item/Abstract.php
and look for :
/**
* Gets a url slug for this item, based on it's title
*
* @return string The slug
*/
public function getSlug($str = null)
{
if( null === $str ) {
$str = $this->getTitle();
}
if( strlen($str) > 32 ) {
$str = Engine_String::substr($str, 0, 32) . '...';
}
$str = preg_replace('/([a-z])([A-Z])/', '$1 $2', $str);
$str = strtolower($str);
$str = preg_replace('/[^a-z0-9-]+/i', '-', $str);
$str = preg_replace('/-+/', '-', $str);
$str = trim($str, '-');
if( !$str ) {
$str = '-';
}
return $str;
}
Then Change 32 to something else.
ONLY TESTED ON 4.1.4
I hope this helps you
Looking for quality SocialEngine Web Hosting? Look no further than Arvixe Web Hosting!
