[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 Gamers Talk »

my group isn't showing up in the donators list i added my group id/rank id to the 3 in the donator.php page

Code: Select all

application/x-httpd-php donate.php
PHP script text

<?php
/**
*
* @package phpBB3
* @version $Id: donate.php v1.0.4 2012/11/04 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);
}
if (isset($config['donation_email']) && $config['donation_email'] == '')
{
	trigger_error($user->lang['DONATION_DISABLED_EMAIL'], 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'           	=> round($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 user_rank = 9
             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 user_rank = 9
             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 user_rank = 9
             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();

?>

What am I doing wrong?

[ADDON] Donation Mod - Donator list

Post by Stoker »

Maybe you forgot to add the html code to the template files and/or refreshthe template?

[ADDON] Donation Mod - Donator list

Post by Gamers Talk »

I did add the code to the html. Are administrators not allowed in the donator list?

[ADDON] Donation Mod - Donator list

Post by Steve »

application/x-httpd-php donate.php
PHP script text
whats this before the opening php tag? are u sure the group rank is number 9?

[ADDON] Donation Mod - Donator list

Post by Gamers Talk »

I have created a group called "donators" that group is going to get more access and features than registerd users get. I also have a special rank for "donators" that I have added to the group in my "managed groups". A administrator recently donated money and I added that person to the donators group. The person is a group member of administrators, moderators, registered users, and donators (main default group administrators). Is there any way to add them to the list without adding the group_id or user_rank? or if they are registered users they automatically get put in the donators group instead of having to do it manually.

The add-on mod works just fine I figured out that the person who donated (administrator) has to have the rank image set to default in order for the user_rank to work or has to have the default of donators group if using group_id. I have added that administrator to the donators group but it would be nice if that persons name would show up in the "thanks to the donators" list for their contribution.

hopefully in the next version something like this can be applied.

[ADDON] Donation Mod - Donator list

Post by Mess »

I'm having an issue. My donators are all part of the same group. But only half has it as main group, and only a few of those has the same rank. How should I solve this? Is it not possible to display all who is part of the group, eventhough its not their primary?

Right now I'm using 6 OR's and the list is getting longer. :(

[ADDON] Donation Mod - Donator list

Post by Stoker »

You just need to use the ID of the rank you have for donators.

[ADDON] Donation Mod - Donator list

Post by Mess »

Stoker wrote:You just need to use the ID of the rank you have for donators.
I currently have 2 ranks, 2 groups and a user id. :/

[ADDON] Donation Mod - Donator list

Post by Stoker »

Why not just give all donators the same rank??

[ADDON] Donation Mod - Donator list

Post by Mess »

Im using ranks to show hirachy in the community. :(