[BUG] Goal is (not) reached.

Download and support for PhpBB3 Forum Goal MOD
User avatar
Mii
BBCoder II
BBCoder II
Posts: 47
Joined: 28 Nov 2011, 21:16
BBCodes: 14

[BUG] Goal is (not) reached.

Post by Mii »

Look at the last goal. This can't be right...
sc.png
You do not have the required permissions to view the files attached to this post.
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 21:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark

[BUG] Goal is (not) reached.

Post 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,
));
}

}
?>
Board rules! No PM support
User avatar
Mii
BBCoder II
BBCoder II
Posts: 47
Joined: 28 Nov 2011, 21:16
BBCodes: 14

[BUG] Goal is (not) reached.

Post 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.
Cable Player
BBCoder II
BBCoder II
Posts: 39
Joined: 05 Dec 2011, 21:58
BBCodes: 0

[BUG] Goal is (not) reached.

Post by Cable Player »

Hey there,
Thanks for posting the updated file, that has fixed the issue for me :)