Comma/Decimal point

Modifications for phpBB3.
Try the Mods here and share Your own Mods
Forum rules
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support

Post by TheMathematics »

================
Last edited by TheMathematics on 09 Aug 2015, 08:23, edited 1 time in total.

Comma/Decimal point

Post by Rhyno »

Heya I just applied this in my forum.... Can some one give me the code for the donation goal to get the percent working.... couldn't find it in the file

Comma/Decimal point

Post by Rhyno »

Rhyno3000 wrote:Heya I just applied this in my forum.... Can some one give me the code for the donation goal to get the percent working.... couldn't find it in the file
Any help for this?

See screenshot to see what i mean...
Donation goal percentage isn't the same as others.

http://www.eaf.net.au/random_stuff/donationgoal.png

Comma/Decimal point

Post by Stoker »

Stoker wrote:Try: number_format($forum_goals_posts_percent, 2),
Thats what Im using.

Comma/Decimal point

Post by Rhyno »

Yer but what file?

Im my includes/functions file there all set my there is no donate php code in there to change though

File is attached :

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: functions_forum_goals.php v1.0.3 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'            => number_format($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'            	=>  number_format($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'            => number_format($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'          => number_format($forum_gallery_topics_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'             => number_format($forum_goals_views_percent, 2),
   'FORUM_VIEW_REST'            	=> $forum_goals_views_rest,
));
}

}
?>

Comma/Decimal point

Post by Stoker »

Its in the index.php file

Comma/Decimal point

Post by Rhyno »

Stoker wrote:Its in the index.php file
So would i change this bit in the index.php

'DONATION_GOAL_NUMBER' => number_format($donation_goal_number),

to

number_format($forum_goals_posts_percent, 2),

Comma/Decimal point

Post by Stoker »

This is the exact code from index.php

Code: Select all

if (!empty($config['donation_goal_enable']) &&  $config['donation_goal'] > 0)
{
$donation_goal_number = ($config['donation_achievement'] * 100) / $config['donation_goal'];
$donation_goal_rest = $config['donation_goal'] - $config['donation_achievement'];
$template->assign_vars(array(
   'DONATION_GOAL_NUMBER'           => number_format($donation_goal_number, 2),
   'DONATION_GOAL_REST'            	=> $donation_goal_rest,
));
}

Comma/Decimal point

Post by Rhyno »

Stoker wrote:This is the exact code from index.php

Code: Select all

if (!empty($config['donation_goal_enable']) &&  $config['donation_goal'] > 0)
{
$donation_goal_number = ($config['donation_achievement'] * 100) / $config['donation_goal'];
$donation_goal_rest = $config['donation_goal'] - $config['donation_achievement'];
$template->assign_vars(array(
   'DONATION_GOAL_NUMBER'           => number_format($donation_goal_number, 2),
   'DONATION_GOAL_REST'            	=> $donation_goal_rest,
));
}
Exactly what i was looking for thanks...

Do you know what the code change is for the donation section page
(one where is shows you list of donators.. mine shows this currently : 85.8333333333%

http://www.eaf.net.au/forums/donate.php

Comma/Decimal point

Post by Stoker »

MAke sure you use latest version of the mod