How to Make the Blog Title Accept More than 32 Characters in SocialEngine 4

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

Looking for quality SocialEngine Web Hosting? Look no further than Arvixe Web Hosting!
Tags: , , , , , , , , , , , , | Posted under 3rd Party Software, SocialEngine | RSS 2.0

Author Spotlight

Andrew Cross

Andrew Cross

Hi, I'm Andrew. A am a 26, ICT Administrator which offers support to company's around the South Wales Area. I have created a few social sites for myself and other company's. So far 2 out of 3 have been successful using the powerful SocialEngine Script. I continue to try and help the community of SocialEngine by giving Support and Technical Help where possible.

Leave a Reply

Your email address will not be published. Required fields are marked *


8 + 9 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>