Hello,
When I view a particular group at the top of the page and under the main graphic there is a list of er of members, discussions, announcements, etc. Even though there are more than 10 discussions in this group that number does not match the number of actual discussions in the group. How can I make this change?
HI Gene,
What Jomsocial version are you using? I cant see it from backend, since the backend access is not working "Username and password do not match or you do not have an account yet."
If you used old Jomsocial version, please you upgrade to the latest one, because this is old issue.
thank you
Hi Gene,
Please you open file components/com_community/models/discussions.php, replace function getDiscussionTopics with this code :
public function getDiscussionTopics( $groupId , $limit = 0 , $order = '' )
{
$db = $this->getDBO();
$limit = ($limit == 0) ? $this->getState( 'limit' ) : $limit;
$limitstart = $this->getState( 'limitstart' );
$query = 'SELECT COUNT(*) FROM ' . $db->quoteName('#__community_groups_discuss') . ' '
. 'WHERE ' . $db->quoteName( 'groupid' ) . '=' . $db->Quote( $groupId )
. 'AND ' . $db->quoteName('parentid') .'=' . $db->Quote( '0' );
$db->setQuery( $query );
$total = $db->loadResult();
$this->total = $total;
if($db->getErrorNum())
{
JError::raiseError( 500, $db->stderr());
}
if( empty($this->_pagination) )
{
jimport('joomla.html.pagination');
$this->_pagination = new JPagination( $total , $limitstart , $limit);
}
$orderByQuery = '';
switch( $order )
{
default:
$orderByQuery = 'ORDER BY a.' . $db->quoteName('lastreplied') .' DESC ';
break;
}
$query = 'SELECT a.*, COUNT( b.' . $db->quoteName('id').' ) AS count, b.' . $db->quoteName('comment') .' AS lastmessage , b.' . $db->quoteName('post_by') .' AS lastmessageby '
. ' FROM ' . $db->quoteName( '#__community_groups_discuss' ) . ' AS a '
. ' LEFT JOIN ' . $db->quoteName( '#__community_wall' ) . ' AS b ON b.' . $db->quoteName('contentid') .'=a.' . $db->quoteName('id')
. ' AND b.' . $db->quoteName('date') .'=( SELECT max( date ) FROM ' . $db->quoteName('#__community_wall').' WHERE ' . $db->quoteName('contentid').'=a.' . $db->quoteName('id').' ) '
. ' AND b.' . $db->quoteName('type').'=' . $db->Quote( 'discussions' )
. ' LEFT JOIN ' . $db->quoteName( '#__community_wall' ) . ' AS c ON c.' . $db->quoteName('contentid').'=a.' . $db->quoteName('id')
. ' AND c.' . $db->quoteName('type').'=' . $db->Quote( 'discussions')
. ' WHERE a.' . $db->quoteName('groupid').'=' . $db->Quote( $groupId )
. ' AND a.' . $db->quoteName('parentid').'=' . $db->Quote( '0' )
. ' GROUP BY a.' . $db->quoteName('id')
. $orderByQuery
. 'LIMIT ' . $limitstart . ',' . $limit;
$db->setQuery( $query );
$result = $db->loadObjectList();
if($db->getErrorNum())
{
JError::raiseError( 500, $db->stderr());
}
return $result;
}
Hi Dimas,
I swapped out the code for that section but it hasn't fixed the issue. It's still showing a max of 10 discussions. Is there somewhere else we should be looking? Sorry but I cannot grant FTP access.
Thanks,
Gene
Hi Gene,
I see, i think update to the newest is required because I think the patch will be effected to another functions.
thank you
You're welcome..