ISSUE SUMMARY:
hi i updated to joomla 3.6.0 and added the pacth from you guys and its working fine now the jomsocial back end.
but now i have Fatal error: Call to undefined method CommunityModelActivities::removeActivity() in /home/crossupc/redempleo.mx/components/com_community/libraries/activities.php on line 32
STEPS TO REPLICATE:
1 try to delete an user from jomsocial backend
2 try to delete an user from joomla backend
3
4
5
RESULT
EXPECTED RESULT
BROWSER
Hi Gustavo,
I tried to replicated on your site
- add new user
- post status on profile page
- delete that new user from backend
and everything is working fine, can you provide me more detail steps to replicate this?
thank you!
Hi Gustavo,
Would you mind provide me the screenshoot / video, please?
thank you!
please let me know then :)
what is the url to access that error ? if that action after delete user, please provide me the video.. because I cant replicate it on your site..
thank you!
Hi,
I able to replicate it, but on different why, I am not sure this is related or no with your issue, I already reported this to our developer.
thank you!
Hi,
Please you try this fix open this file administrator/components/com_community/models/activities.php, and add this code after line 245 :
/**
* Remove an activity by ID
* @param type $activityId
* @return boolean
*/
public function hideActivityById($activityId)
{
$table = JTable::getInstance('Activity', 'CTable');
$table->load($activityId);
$archived = 1;
$message = JText::_('COM_COMMUNITY_WALL_REMOVED');
if ($table->archived == 1) {
$archived = 0;
$message = JText::_('COM_COMMUNITY_WALL_RESTORED');
}
$db = $this->getDBO();
$query = 'UPDATE ' . $db->quoteName('#__community_activities') . ' SET ' . $db->quoteName('archived') . ' = ' . $db->Quote($archived)
. ' WHERE ' . $db->quoteName('id') . '=' . $db->quote($activityId) . ' ';
$db->setQuery($query);
try {
$status = $db->execute();
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
return $message;
}
public function removeActivity($app, $uniqueId)
{
$db = $this->getDBO();
/*
* @todo add in additional info if needed
* when removing photo app, we need to remove the likes and comments as well
*/
$additionalQuery = '';
switch ($app) {
case 'photos' :
//before we remove anything, lets check if this photo is included in the params of activity
// that might be more than one photo
$db->setQuery(
"SELECT albumid FROM ".$db->quoteName('#__community_photos')." WHERE id=".$db->quote($uniqueId)
);
$albumId = $db->loadResult();
$db->setQuery(
"SELECT id, params FROM ".$db->quoteName('#__community_activities'). " WHERE "
.$db->quoteName('app') . '=' . $db->Quote($app)." AND "
.$db->quoteName('cid') . '=' . $db->Quote($albumId)
);
$activities = $db->loadObjectList();
if(count($activities) == 0){
return;
}
//search through the parameters of the activities
foreach($activities as $activity){
$params = new CParameter($activity->params);
$photoIds = $params->get('photosId');
$photoIds = explode(',',$photoIds);
if(in_array($uniqueId, $photoIds)){
if(count($photoIds) > 1){
//do not delete this activities as there is another photo associated with this activity
if(($key = array_search($uniqueId, $photoIds)) !== false) {
unset($photoIds[$key]);
}
$params->set('photosId',implode(',',$photoIds));
$activityTable = JTable::getInstance('Activity', 'CTable');
$activityTable->load($uniqueId);
//just update the activity will do
$activityTable->params = $params->toString();
$activityTable->store();
}else{
// just delete the activity
$db->setQuery(
"DELETE FROM ".$db->quoteName('#__community_activities')." WHERE "
.$db->quoteName('id').' = '.$db->quote($activity->id)
);
$db->execute();
}
}
}
return;//return as the additional steps are not needed
//we should remove the likes and comments
$additionalQuery = '(' . $db->quoteName('app') . '=' . $db->Quote($app) .
' OR ' . $db->quoteName('app') . '=' . $db->Quote('photos.comment') .
' OR ' . $db->quoteName('app') . '=' . $db->Quote('album.like') .
' OR ' . $db->quoteName('app') . '=' . $db->Quote('profile.avatar.upload') .
' OR ' . $db->quoteName('app') . '=' . $db->Quote('photo.like') . ')';
break;
case 'videos' :
$additionalQuery = '(' . $db->quoteName('app') . '=' . $db->Quote($app) .
' OR ' . $db->quoteName('app') . '=' . $db->Quote('videos.linking') .
' OR ' . $db->quoteName('app') . '=' . $db->Quote('videos.comment') .
' OR ' . $db->quoteName('app') . '=' . $db->Quote('videos.like') . ')';
break;
case 'albums':
$additionalQuery = $db->quoteName('app') . ' like' . $db->Quote('%photos%');
break;
default :
// this is the default state
$additionalQuery = $db->quoteName('app') . '=' . $db->Quote($app);
}
$query = 'DELETE FROM ' . $db->quoteName('#__community_activities') . ' '
. 'WHERE ' .$additionalQuery . ' '
. 'AND ' . $db->quoteName('cid') . '=' . $db->Quote($uniqueId);
$db->setQuery($query);
try {
$status = $db->execute();
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
return $status;
}