[ADDON] Donation Mod - Donator list

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

[ADDON] Donation Mod - Donator list

Post by Solidjeuh »

Stoker wrote:Change the number 10 in "AND group_id = 10" to the ID of your donator group.

[ADDON] Donation Mod - Donator list

Post by Rhyno »

Solidjeuh wrote:
Stoker wrote:Change the number 10 in "AND group_id = 10" to the ID of your donator group.
Done that

[ADDON] Donation Mod - Donator list

Post by Rhyno »

This is what i see.... changed group to 18 which is my vip group

Image

[ADDON] Donation Mod - Donator list

Post by Solidjeuh »

refreshed templates? empty the forum cache?

[ADDON] Donation Mod - Donator list

Post by Rhyno »

Solidjeuh wrote:refreshed templates? empty the forum cache?
Yep

[ADDON] Donation Mod - Donator list

Post by Stoker »

Make sure you have added all the needed code to donate.php
Else post you donate.php here

[ADDON] Donation Mod - Donator list

Post by Rhyno »

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: donate.php 23:34 24/05/2011 Stoker $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/donate');

// Do we have the donation mod enabled

if (isset($config['donation_enable']) && $config['donation_enable'] == 0)
{
	trigger_error($user->lang['DONATION_DISABLED'], E_USER_NOTICE);
}
// check for mod installed
if (empty($config['donation_mod_version']))
{
	if($user->data['user_type'] == USER_FOUNDER)
	{
		$installer =  append_sid("{$phpbb_root_path}install_donation_mod.$phpEx");
		$message = sprintf($user->lang['DONATION_NOT_INSTALLED'], '<a href="' . $installer . '">', '</a>');
	}
	else
	{
		$message = $user->lang['DONATION_NOT_INSTALLED_USER'];
	}
	trigger_error ($message);
}

$sql = 'SELECT * FROM ' . DONATION_TABLE;
		$result = $db->sql_query($sql);
		$donation = array();
		while ($row = $db->sql_fetchrow($result))	
		{
			$donation[$row['config_name']] = $row['config_value'];
		}
		$db->sql_freeresult($result);
						
$donation_body = isset($donation['donation_body']) ? $donation['donation_body'] : '';
$donation_cancel = isset($donation['donation_cancel']) ? $donation['donation_cancel'] : '';
$donation_success = isset($donation['donation_success']) ? $donation['donation_success'] : '';	
$success_url = generate_board_url() . '/donate.php?mode=success';
$cancel_url = generate_board_url() . '/donate.php?mode=cancel';

$mode = request_var('mode', '');

switch ($mode)
{
	case 'success':
		page_header($user->lang['DONATION_SUCCESSFULL_TITLE']);
		$template->set_filenames(array(
			'body' => 'donate/success_body.html')
		);
	break;

	case 'cancel':
		page_header($user->lang['DONATION_CANCELLED_TITLE']);
		$template->set_filenames(array(
			'body' => 'donate/cancel_body.html')
		);
	break;

	default:
		page_header($user->lang['DONATION_TITLE']);
		$template->set_filenames(array(
			'body' => 'donate/donate_body.html')
		);
	break;
}

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

// Random donator list 
switch ($db->sql_layer)
   {
      case 'postgres':
         $sql = 'SELECT username, user_id, user_colour
         FROM ' . USERS_TABLE . '
         WHERE user_type <> ' . USER_IGNORE . ' AND group_id = 21
         AND user_type <> ' . USER_INACTIVE . '
         ORDER BY RANDOM()';
      break;
   
      case 'mssql':
      case 'mssql_odbc':
         $sql = 'SELECT username, user_id, user_colour
         FROM ' . USERS_TABLE . '
         WHERE user_type <> ' . USER_IGNORE . ' AND group_id = 21
         AND user_type <> ' . USER_INACTIVE . '
         ORDER BY NEWID()';
      break;
   
      default:
         $sql = 'SELECT username, user_id, user_colour
         FROM ' . USERS_TABLE . '
         WHERE user_type <> ' . USER_IGNORE . ' AND group_id = 21
         AND user_type <> ' . USER_INACTIVE . '
         ORDER BY RAND()';
      break;
   }
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{   
   $username = $row['username'];
   $user_id = (int) $row['user_id'];
   $colour = $row['user_colour'];

   $template->assign_block_vars('donate_list', array(
   'USERNAME_FULL'      => get_username_string('full', $user_id, $username, $colour),
));
}
$db->sql_freeresult($result);

// Lets build a page ...
$template->assign_vars(array(
	'U_DONATE_SUCCESS'					=> $success_url,
	'U_DONATE_CANCEL'					=> $cancel_url,
	'DONATION_EMAIL'					=> $config['donation_email'],
	'DONATION_ACHIEVEMENT_ENABLE'		=> $config['donation_achievement_enable'],
	'DONATION_ACHIEVEMENT'				=> $config['donation_achievement'],
	'DONATION_GOAL_ENABLE'				=> $config['donation_goal_enable'],
	'DONATION_GOAL'						=> $config['donation_goal'],
	'DONATION_GOAL_CURRENCY_ENABLE'		=> $config['donation_goal_currency_enable'],
	'DONATION_GOAL_CURRENCY'			=> $config['donation_goal_currency'],
	'DONATION_BODY'						=> html_entity_decode($donation_body),
	'DONATION_CANCEL'					=> html_entity_decode($donation_cancel),
	'DONATION_SUCCESS'					=> html_entity_decode($donation_success),
));


// Set up Navlinks
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => ($user->lang['DONATION_TITLE']),
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}donate.$phpEx"))
);

page_footer();

?>

[ADDON] Donation Mod - Donator list

Post by Stoker »

Change the group id to some existing.
Do you know how to fetch the group id?

[ADDON] Donation Mod - Donator list

Post by Rhyno »

Stoker wrote:Change the group id to some existing.
Do you know how to fetch the group id?
OK tried group 2 - registered users that worked fine

[ADDON] Donation Mod - Donator list

Post by Stoker »

Then you have been using a non existing group id.
Navigate to ACP - Manage groups.
With the mouse cursor you hover the Settings options. The last number in the link is the group id