By jesus on Wednesday, 07 May 2014
Posted in General Issues
Replies 16
Likes 0
Views 1K
Votes 0
Hi,
I'm having a problem with the integration between Easydiscuss and Jomsocial.
When someone reply to a question, the reply is repeat tree times in the Jomsocial wall.
It doesn't happen with the question. It happens only with the replies.
Easydiscuss ver. 3.1.8872
Jomsocial ver. 3.1.1.
Could you help me?
Thanks
Hello jesus,

Is it possible for you to provide us with the back end and FTP access to your site to check on this issue?
·
Wednesday, 07 May 2014 03:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

I can't give you access because the Privacy Policy, sorry.
Please tell me what files or configuration you want to see and I'll attach to you.

Thanks
Jesus
·
Wednesday, 07 May 2014 15:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello jesus,

Sorry for late reply to this,
We hard to tell you what is the happening if can't do the debugging in your site. Hope you understand.
Is it possible update to latest version of Easydiscuss and see how it goes? Please advise.
·
Wednesday, 07 May 2014 18:43
·
0 Likes
·
0 Votes
·
0 Comments
·
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
·
Thursday, 08 May 2014 02:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jesus,

I'm going to install the website in another server to give you access. 

Okay, let us know when you're ready.
May i know did you consider to update the latest version of Easydiscuss? If yes, try update to latest version of Easydiscuss and see the issues is it still persists?
·
Thursday, 08 May 2014 02:41
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

I've provide you with the back end and FTP access of the new server for try (in Site Details)

Please, have a look.

Thanks
·
Friday, 16 May 2014 00:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello jesus,

Sorry for late reply to this,
Thanks for take your time to install the website and provide all the details for us, that was very helpful to help us debugging in your site directly,

But I getting this when i access in your Joomla backend
Forbidden

You don't have permission to access /administrator/ on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
[/code]
Can you consult with your Webhosting provider regarding this?
If needed unblock our IP address : 175.145.128.200 || 175.142.129.96

By the way, the FTP login credential you provided is not working,

Response: 530 Login authentication failed
Error: Critical error
Error: Could not connect to server

Please advise.
·
Friday, 16 May 2014 01:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

I'm going to consult with the webhosting provider.

Could you quit the link to the joomla backend for the previous post?

Thanks
·
Friday, 16 May 2014 02:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello jesus,

Sorry for late reply to this,
I have help you removed that joomla backend link at my previous post.
Okay, keep us updated then.
By the way, can i have the permission to help you update to latest version of Easydiscuss?
It might was a bug in older version regarding this issues. Please advise.
·
Friday, 16 May 2014 11:06
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Could you try now to access? My webhosting provider has made something for 5 days (I don't know what)

I've updated to 3.2.9422 and now I've a new problem because there is some javascript conflict. Now I can't send a post or I can't see login popup.

Could you check both issues also?

Thanks
·
Saturday, 17 May 2014 02:01
·
0 Likes
·
0 Votes
·
0 Comments
·
hello jesus,

I am really sorry for the delay of this reply as it is a weekend for us here.
Thanks for getting back to us,

I have checked in your frontend, it seems like some plugin conflict with EasyDiscuss script, because i noticed that editor doesn't load out.

Yes, i can access your Joomla backend now, but i hitting this htaccess block, check my attachment screenshot.

Please advise.
·
Saturday, 17 May 2014 11:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

I've added in Site Details -> Optional information: the details about htaccess user and pass.

Please, tell me exactly the steps that you do to solve the problem. I have to repeat the steps in the production server.

Thanks
·
Saturday, 17 May 2014 14:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jesus,

I have checked this plugin "System - JFBCSystem" is causing when you reply it show another stream in your JomSocial page,
I help you temporary disabled this plugin, it work fine now. Please have a check.

And another thing is i help you change the environment mode to static from your backend > Easydiscuss > Setting > Maintenance
So the script is work fine now.
·
Saturday, 17 May 2014 15:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

1º so the problem in the javascript was activate enviroment mode to static? What does it do?

2º I've activated again the plugin System - JFBCSystem and works fine the jomsocial stream so this plugin is not causing the problem. Have you done something else?

I'm going to check more but until now the steps that you have done are:

a) After the upgrade activate the enviroment mode to static. Is it right?

Thanks
Jesus
·
Saturday, 17 May 2014 16:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

you are right , when I activate the plugin the reply appears 3 times in the jomsocial stream. I don't know what to do, I need this plugin.

Thanks
·
Saturday, 17 May 2014 18:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello jesus,

I am really sorry for the delay of this reply as it is a weekend for us here.

That was because you're using the 3.1 version of Easydiscuss and used the 2.1 foundry in your site.
After you upgrade to latest version of Easydiscuss, we already updated the foundry to 3.1 in the latest version of Easydiscuss.
So the environment mode will set to default to development mode, the development mode mean "Loads all script files separately", so all of the script loading separately, so the drop down button and the submit button will not work fine.

Can you consult this plugin with the developer and see how it goes? Please advise.
·
Sunday, 18 May 2014 11:56
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post