Page 1 of 1

[BUG] Goal is (not) reached.

Posted: 08 Jan 2012, 21:55
by Mii
Look at the last goal. This can't be right...
Screen
Screen

[BUG] Goal is (not) reached.

Posted: 08 Jan 2012, 22:03
by Stoker
Try version 1.0.4 of the functions file:

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: functions_forum_goals.php v1.0.4 2011/05/12  $
* @copyright (c) 2011 PhpBB3 BBCodes
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* Include only once.
*/
if (!defined('INCLUDES_FUNCTIONS_FORUM_GOALS_PHP'))
{
	define('INCLUDES_FUNCTIONS_FORUM_GOALS_PHP', true);
	
if (!empty($config['forum_goals_posts_enable']) &&  $config['forum_goals_posts'] > 0)
{
$forum_goals_posts_percent = ($total_posts * 100) / $config['forum_goals_posts'];
$forum_goals_posts_rest = $config['forum_goals_posts'] - $total_posts;
$template->assign_vars(array(
   'FPG_ENABLE'		            	=> $config['forum_goals_posts_enable'],
   'FORUM_POST_GOAL'            	=> $config['forum_goals_posts'],
   'FORUM_POST_PERCENT'            	=> number_format($forum_goals_posts_percent, 2),
   'FORUM_POST_REST'            	=> $forum_goals_posts_rest,
));
}

if (!empty($config['forum_goals_topics_enable']) &&  $config['forum_goals_topics'] > 0)
{
$forum_goals_topics_percent = ($total_topics * 100) / $config['forum_goals_topics'];
$forum_goals_topics_rest = $config['forum_goals_topics'] - $total_topics;
$template->assign_vars(array(
   'FTG_ENABLE'		            	=> $config['forum_goals_topics_enable'],
   'FORUM_TOPIC_GOAL'            	=> $config['forum_goals_topics'],
   'FORUM_TOPIC_PERCENT'            => round($forum_goals_topics_percent, 2),
   'FORUM_TOPIC_REST'            	=> $forum_goals_topics_rest,
));
}

if (!empty($config['forum_goals_users_enable']) &&  $config['forum_goals_users'] > 0)
{
$forum_goals_users_percent = ($total_users * 100) / $config['forum_goals_users'];
$forum_goals_users_rest = $config['forum_goals_users'] - $total_users;
$template->assign_vars(array(
   'FUG_ENABLE'		            	=> $config['forum_goals_users_enable'],
   'FORUM_USER_GOAL'            	=> $config['forum_goals_users'],
   'FORUM_USER_PERCENT'            	=> round($forum_goals_users_percent, 2),
   'FORUM_USER_REST'            	=> $forum_goals_users_rest,
));
}

if (!empty($config['forum_goals_files_enable']) &&  $config['forum_goals_files'] > 0)
{
$total_files	= $config['num_files'];
$l_total_file_s = ($total_files == 0) ? 'TOTAL_FILES_ZERO' : 'TOTAL_FILES_OTHER';
$forum_goals_files_percent = ($total_files * 100) / $config['forum_goals_files'];
$forum_goals_files_rest = $config['forum_goals_files'] - $total_files;
$template->assign_vars(array(
   'FFG_ENABLE'		            	=> $config['forum_goals_files_enable'],
   'TOTAL_FILES'	            	=> sprintf($user->lang[$l_total_file_s], $total_files),
   'FORUM_FILES_GOAL'            	=> $config['forum_goals_files'],
   'FORUM_FILES_PERCENT'            => round($forum_goals_files_percent, 2),
   'FORUM_FILES_REST'            	=> $forum_goals_files_rest,
));
}

if ((class_exists('phpbb_gallery_integration')) && !empty($config['forum_goals_gallery_enable']) &&  $config['forum_goals_gallery'] > 0)
{
$forum_goals_gallery_percent = (phpbb_gallery_config::get('num_images') * 100) / $config['forum_goals_gallery'];
$forum_goals_gallery_rest = $config['forum_goals_gallery'] - phpbb_gallery_config::get('num_images');
$template->assign_vars(array(
   'FGG_ENABLE'		            	=> $config['forum_goals_gallery_enable'],
   'FORUM_GALLERY_GOAL'            	=> $config['forum_goals_gallery'],
   'FORUM_GALLERY_PERCENT'          => round($forum_goals_gallery_percent, 2),
   'FORUM_GALLERY_REST'            	=> $forum_goals_gallery_rest,
));
}

if (!empty($config['forum_goals_views_enable']) &&  $config['forum_goals_views'] > 0)
{
		$sql = 'SELECT SUM(topic_views) AS count
			FROM ' . TOPICS_TABLE . '
			WHERE topic_approved = 1';
		$result = $db->sql_query($sql);
		$total_views = (int) $db->sql_fetchfield('count');

$forum_goals_views_percent = ($total_views * 100) / $config['forum_goals_views'];
$forum_goals_views_rest = $config['forum_goals_views'] - $total_views;
$template->assign_vars(array(
   'FTVG_ENABLE'		            => $config['forum_goals_views_enable'],
   'TOTAL_VIEWS'        			=> $total_views, 
   'FORUM_VIEW_GOAL'            	=> $config['forum_goals_views'],
   'FORUM_VIEW_PERCENT'             => round($forum_goals_views_percent, 2),
   'FORUM_VIEW_REST'            	=> $forum_goals_views_rest,
));
}

}
?>

[BUG] Goal is (not) reached.

Posted: 08 Jan 2012, 23:11
by Mii
Oh, I installed it 2 weeks ago or so and only have 1.0.1... o_O
I'll try it.
EDIT: nvm, I got 1.0.3 which is the latest release. But I'll try it anyways.

[BUG] Goal is (not) reached.

Posted: 03 Jul 2012, 20:50
by Cable Player
Hey there,
Thanks for posting the updated file, that has fixed the issue for me :)