Kunena 6.2.1 Released with module latest 6.0.4 and module kunena stats 6.0.4
The Kunena team has announce the arrival of Kunena 6.2.1 [K 6.2.1] which is now available for download as a native Joomla extension for J! 4.3.x/4.4.x/5.0.x. This version addresses most of the issues that were discovered in K 6.1.0 and issues discovered during the last development stages of K 6.1
Solved How to trim text posts in the jomsocial activity?
- romagromov
-
Topic Author
- Offline
- Senior Member
Download Free Software for Windows absolutly free.
Please Log in or Create an account to join the conversation.
It's hard to trim because you can break links and bbcode things
I don't provide support by PM, because this can be useful for someone else.
Please Log in or Create an account to join the conversation.
- romagromov
-
Topic Author
- Offline
- Senior Member
In old versions it was possible...
May be sometimes bbcode was broken, but it was more good than posts with 1500 symbols in activity stream...
Also, I think we can exclude any bbcode in activity stream. It's absolutely normal.
Something like this: If {b} replace with empty space...
Sorry, I'm not programmer, but full posts in activity stream it's full ..... It's not good ((
Download Free Software for Windows absolutly free.
Please Log in or Create an account to join the conversation.
I don't provide support by PM, because this can be useful for someone else.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- romagromov
-
Topic Author
- Offline
- Senior Member
xillibit wrote: I think it has been removed because it can break bbcode, you can try to use wordwrap() function to do it but if you have bbcodes it will be broken and it's more complex to trim without break bbcodes
How to use wordwrap() function?
What file I need edit to use wordwrap() function?
And one more question: your module kunena latest perfect trim text without any problem...
Download Free Software for Windows absolutly free.
Please Log in or Create an account to join the conversation.
- romagromov
-
Topic Author
- Offline
- Senior Member
Open file /plugins/kunena/community/community/activity.php
replace all strings
with
where 300 (characters) - is parameter what you can change for your needs.
Works perfect. Bbcode is ok. Text and tags not broken.
Download Free Software for Windows absolutly free.
Please Log in or Create an account to join the conversation.
- romagromov
-
Topic Author
- Offline
- Senior Member
So, what we need:
replace all strings
$act->content = $content;
with
$act->content = KunenaHtmlParser::stripBBCode ($content, 300);
remove strings
// Add readmore permalink
$content .= '<br /><a rel="nofollow" href="'.$message->getTopic()->getPermaUrl().'" class="small profile-newsfeed-item-action">'.JText::_('COM_KUNENA_READMORE').'</a>'
add code
$act->content.= '<br /><a rel="nofollow" href="'.$message->getTopic()->getPermaUrl().'" class="small profile-newsfeed-item-action">'.JText::_('COM_KUNENA_READMORE').'</a>';
after strings
$act->content = KunenaHtmlParser::stripBBCode ($content, 300);
So we have this code in file /plugins/kunena/community/community/activity.php
<?php
/**
* Kunena Plugin
* @package Kunena.Plugins
* @subpackage Community
*
* @copyright (C) 2008 - 2012 Kunena Team. All rights reserved.
* @license www.gnu.org/copyleft/gpl.html GNU/GPL
* @link www.kunena.org
**/
defined ( '_JEXEC' ) or die ();
jimport('joomla.utilities.string');
class KunenaActivityCommunity extends KunenaActivity {
protected $params = null;
public function __construct($params) {
$this->params = $params;
}
public function onAfterPost($message) {
if (JString::strlen($message->message) > $this->params->get('activity_points_limit', 0)) {
CFactory::load ( 'libraries', 'userpoints' );
CUserPoints::assignPoint ( 'com_kunena.thread.new' );
}
$content = KunenaHtmlParser::plainBBCode($message->message, $this->params->get('activity_stream_limit', 10));
$act = new stdClass ();
$act->cmd = 'wall.write';
$act->actor = $message->userid;
$act->target = 0; // no target
$act->title = JText::_ ( '{actor} ' . JText::sprintf ( 'PLG_KUNENA_COMMUNITY_ACTIVITY_POST_TITLE', ' <a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a>') );
$act->content = KunenaHtmlParser::stripBBCode ($content, 300);
$act->content.= '<br /><a rel="nofollow" href="'.$message->getTopic()->getPermaUrl().'" class="small profile-newsfeed-item-action">'.JText::_('COM_KUNENA_READMORE').'</a>';
$act->app = 'kunena.post';
$act->cid = $message->thread;
$act->access = $this->getAccess($message->getCategory());
// Comments and like support
$act->comment_id = $message->thread;
$act->comment_type = 'kunena.post';
$act->like_id = $message->thread;
$act->like_type = 'kunena.post';
// Do not add private activities
if ($act->access > 20) return;
CFactory::load ( 'libraries', 'activities' );
CActivityStream::add ( $act );
}
public function onAfterReply($message) {
if (JString::strlen($message->message) > $this->params->get('activity_points_limit', 0)) {
CFactory::load ( 'libraries', 'userpoints' );
CUserPoints::assignPoint ( 'com_kunena.thread.reply' );
}
$content = KunenaHtmlParser::plainBBCode($message->message, $this->params->get('activity_stream_limit', 0));
;
$act = new stdClass ();
$act->cmd = 'wall.write';
$act->actor = $message->userid;
$act->target = 0; // no target
$act->title = JText::_ ( '{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::sprintf ( 'PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TITLE', '<a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a>' ) );
$act->content = KunenaHtmlParser::stripBBCode ($content, 300);
$act->content.= '<br /><a rel="nofollow" href="'.$message->getTopic()->getPermaUrl().'" class="small profile-newsfeed-item-action">'.JText::_('COM_KUNENA_READMORE').'</a>';
$act->app = 'kunena.post';
$act->cid = $message->thread;
$act->access = $this->getAccess($message->getCategory());
// Comments and like support
$act->comment_id = $message->thread;
$act->comment_type = 'kunena.post';
$act->like_id = $message->thread;
$act->like_type = 'kunena.post';
// Do not add private activities
if ($act->access > 20) return;
CFactory::load ( 'libraries', 'activities' );
CActivityStream::add ( $act );
}
public function onAfterThankyou($target, $actor, $message) {
CFactory::load ( 'libraries', 'userpoints' );
CUserPoints::assignPoint ( 'com_kunena.thread.thankyou', $target );
$username = KunenaFactory::getUser($actor)->name;
$act = new stdClass ();
$act->cmd = 'wall.write';
$act->actor = JFactory::getUser()->id;
$act->target = $target;
$act->title = JText::_ ( '{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::sprintf( 'PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_TITLE', $username, ' <a href="' . $message->getPermaUrl() . '">' . $message->subject . '</a>' ) );
$act->content = NULL;
$act->app = 'kunena.thankyou';
$act->cid = $target;
$act->access = $this->getAccess($message->getCategory());
// Comments and like support
$act->comment_id = $target;
$act->comment_type = 'kunena.thankyou';
$act->like_id = $target;
$act->like_type = 'kunena.thankyou';
// Do not add private activities
if ($act->access > 20) return;
CFactory::load ( 'libraries', 'activities' );
CActivityStream::add ( $act );
}
public function onAfterDeleteTopic($target) {
CFactory::load ( 'libraries', 'activities' );
CActivityStream::remove ('kunena.post', $target->id );
}
protected function getAccess($category) {
// Activity access level: 0 = public, 20 = registered, 30 = friend, 40 = private
$accesstype = $category->accesstype;
if ($accesstype != 'joomla.group' && $accesstype != 'joomla.level') {
// Private
return 40;
}
if (version_compare(JVERSION, '1.6','>')) {
// Joomla 1.6+
// FIXME: Joomla 1.6 can mix up groups and access levels
if (($accesstype == 'joomla.level' && $category->access == 1)
|| ($accesstype == 'joomla.group' && ($category->pub_access == 1 || $category->admin_access == 1))) {
// Public
$access = 0;
} elseif (($accesstype == 'joomla.level' && $category->access == 2)
|| ($accesstype == 'joomla.group' && ($category->pub_access == 2 || $category->admin_access == 2))) {
// Registered
$access = 20;
} else {
// Other groups (=private)
$access = 40;
}
} else {
// Joomla 1.5
// Joomla access levels: 0 = public, 1 = registered
// Joomla user groups: 29 = public, 18 = registered
if (($accesstype == 'joomla.level' && $category->access == 0)
|| ($accesstype == 'joomla.group' && ($category->pub_access == 0 || $category->pub_access == 29 || $category->admin_access == 29))) {
// Public
$access = 0;
} elseif (($accesstype == 'joomla.level' && $category->access == 1)
|| ($accesstype == 'joomla.group' && ($category->pub_access == -1 || $category->pub_access == 18 || $category->admin_access == 18))) {
// Registered
$access = 20;
} else {
// Other groups (=private)
$access = 40;
}
}
return $access;
}
}
Download Free Software for Windows absolutly free.
Please Log in or Create an account to join the conversation.
It works just fine. ??
Please Log in or Create an account to join the conversation.