Hi,
I'm going to install the website in another server to give you access.
Meanwhile I've been looking for the problem in /components/com_easydiscuss/helpers/jomsocial.php. The function is:
public function addActivityReply( $post )
{
$core = JPATH_ROOT . '/components/com_community/libraries/core.php';
$config = DiscussHelper::getConfig();
if( !JFile::exists( $core ) )
{
return false;
}
require_once( $core );
// @rule: Insert points for user.
if( $config->get( 'integration_jomsocial_points' ) )
{
CFactory::load( 'libraries' , 'userpoints' );
CUserPoints::assignPoint( 'com_easydiscuss.reply.discussion' , $post->user_id );
}
$lang = JFactory::getLanguage();
$lang->load( 'com_easydiscuss' , JPATH_ROOT );
// We do not want to add activities if new blog activity is disabled.
if( !$config->get( 'integration_jomsocial_activity_reply_question' ) )
{
return false;
}
$link = DiscussRouter::getRoutedURL( 'index.php?option=com_easydiscuss&view=post&id=' . $post->parent_id , false , true );
$replyLink = $link . '#' . JText::_('COM_EASYDISCUSS_REPLY_PERMALINK') . '-' . $post->id;
$parent = DiscussHelper::getTable( 'Post' );
$parent->load( $post->parent_id );
$title = $this->getActivityTitle( $parent->title );
$content = '';
if( $config->get( 'integration_jomsocial_activity_reply_question_content' ) )
{
$content = $post->content;
$pattern = '#<img[^>]*>#i';
preg_match_all( $pattern , $content , $matches );
$imgTag = '';
if( $matches && count( $matches[0] ) > 0 )
{
foreach( $matches[0] as $match )
{
// exclude bbcodes from markitup
if( stristr($match, '/markitup/') === false )
{
$imgTag = $match;
break;
}
}
}
$content = EasyDiscussParser::bbcode( $content );
$content = strip_tags( $content );
$content = JString::substr( $content , 0 , $config->get( 'integration_jomsocial_activity_content_length') ) . '...';
if( $imgTag )
{
$imgTag = JString::str_ireplace( 'img ' , 'img style="margin: 0 5px 5px 0;float:left;height:auto;width: 120px !important;"' , $imgTag );
$content = $imgTag . $content . '<div style="clear:both;"></div>';
}
$content .= '<div style="text-align: right;"><a href="' . $link . '">' . JText::_( 'COM_EASYDISCUSS_JOMSOCIAL_ACTIVITY_REPLY_QUESTION_PARTICIPATE' ) . '</a></div>';
}
//get category privacy.
$category_id = $post->category_id;
if( !$post->category_id && $post->parent_id )
{
$postTable = DiscussHelper::getTable( 'Posts' );
$postTable->load( $post->parent_id );
$category_id = $postTable->category_id;
}
$category = DiscussHelper::getTable( 'Category' );
$category->load( $category_id );
$obj = new stdClass();
$obj->access = $this->getActivityAccess();
$obj->title = JText::sprintf( 'COM_EASYDISCUSS_JOMSOCIAL_ACTIVITY_REPLY_QUESTION' , $replyLink, $link , $title );
$obj->content = $content;
$obj->cmd = 'easydiscuss.question.reply';
$obj->actor = $post->user_id;
$obj->target = 0;
$obj->like_id = $post->id;
$obj->like_type = 'com_easydiscuss';
$obj->comment_id = $post->id;
$obj->comment_type = 'com_easydiscuss';
$obj->app = 'easydiscuss';
$obj->cid = $post->id;
// add JomSocial activities
CFactory::load ( 'libraries', 'activities' );
CActivityStream::add($obj);
}
In /components/com_community/libraries/activities.php the function is:
static public function add($activity, $params = '', $points = 1) {
CError::assert($activity, '', '!empty', __FILE__, __LINE__);
$cmd = !empty($activity->cmd) ? $activity->cmd : '';
if (!empty($cmd)) {
$userPointModel = CFactory::getModel('Userpoints');
$point = $userPointModel->getPointData($cmd);
if ($point) {
if (!$point->published) {
return;
}
}
}
// If params is an object, instead of a string, we convert it to string
$cmd = !empty($activity->cmd) ? $activity->cmd : '';
$actor = !empty($activity->actor) ? $activity->actor : '';
$actors = !empty($activity->actors) ? $activity->actors : '';
$target = !empty($activity->target) ? $activity->target : 0;
$title = !empty($activity->title) ? $activity->title : '';
$content = !empty($activity->content) ? $activity->content : '';
$appname = !empty($activity->app) ? $activity->app : '';
$cid = !empty($activity->cid) ? $activity->cid : 0;
$groupid = !empty($activity->groupid) ? $activity->groupid : 0;
$group_access = !empty($activity->group_access) ? $activity->group_access : 0;
$event_access = !empty($activity->event_access) ? $activity->event_access : 0;
$eventid = !empty($activity->eventid) ? $activity->eventid : 0;
$points = !empty($activity->points) ? $activity->points : $points;
$access = !empty($activity->access) ? $activity->access : 0;
$location = !empty($activity->location) ? $activity->location : '';
$comment_id = !empty($activity->comment_id) ? $activity->comment_id : 0;
$comment_type = !empty($activity->comment_type) ? $activity->comment_type : '';
$like_id = !empty($activity->like_id) ? $activity->like_id : 0;
$like_type = !empty($activity->like_type) ? $activity->like_type : '';
// If the params in embedded within the activity object, use it
// if it is not explicitly overriden
if (empty($params) && !empty($activity->params)) {
$params = $activity->params;
}
$activities = CFactory::getModel('activities');
// Update access for activity based on the user's profile privacy
// since 2.4.2 if access is provided, dont use the default
if (!empty($actor) && $actor != 0 && !isset($access)) {
$user = CFactory::getUser($actor);
$userParams = $user->getParams();
$profileAccess = $userParams->get('privacyProfileView');
// Only overwrite access if the user global profile privacy is higher
// BUT, if access is defined as PRIVACY_FORCE_PUBLIC, do not modify it
if (($access != PRIVACY_FORCE_PUBLIC) && ($profileAccess > $access)) {
$access = $profileAccess;
}
}
$table = JTable::getInstance('Activity', 'CTable');
$table->actor = $actor;
$table->actors = $actors;
$table->target = $target;
$table->title = $title;
$table->content = $content;
$table->app = $appname;
$table->cid = $cid;
$table->groupid = $groupid;
$table->group_access = $group_access;
$table->eventid = $eventid;
$table->event_access = $event_access;
$table->points = $points;
$table->access = $access;
$table->location = $location;
$table->params = $params;
$table->comment_id = $comment_id;
$table->comment_type = $comment_type;
$table->like_id = $like_id;
$table->like_type = $like_type;
$table->store();
// Update comment id, if we comment on the stream itself
if ($comment_id == CActivities::COMMENT_SELF) {
$table->comment_id = $table->id;
}
// Update comment id, if we like on the stream itself
if ($comment_id == CActivities::LIKE_SELF) {
$table->like_id = $table->id;
}
if ($comment_id == CActivities::COMMENT_SELF || $comment_id == CActivities::LIKE_SELF) {
$table->store();
}
}
With new questions, comments and likes it works fine. For replies it repeat 3 times the post. It must be the command:
$obj->cmd = 'easydiscuss.question.reply';
because is the only difference with others functions in /components/com_easydiscuss/helpers/jomsocial.php.
Thanks
Jesus