Request

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

Request

Post by martin123456 »

Vote Keywen Encyclopedia Links [Bot] for President!

I like this feature i don't think many have noticed it i can't really see any need for it or what use it is but i really do like it :D yes i know i'm sad

Request

Post by Stoker »

I saw something similar at phpbbmodders :D

Add this to index.php, just before // Assign index specific vars

Code: Select all

switch ($db->sql_layer)
{
	case 'postgres':
		$order_by = 'RANDOM()';
	break;

	case 'mssql':
	case 'mssql_odbc':
		$order_by = 'NEWID()';
	break;
	
	default:
		$order_by = 'RAND()';
	break;
}

$sql = 'SELECT user_id, user_type, username, user_colour
	FROM ' . USERS_TABLE . ' WHERE user_type = 2
	ORDER BY ' . $order_by;
$result = $db->sql_query_limit($sql, 1);

while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('users', array(
'BOT_NAME'		=> $row['username'],
'BOT_COLOUR'	=> $row['user_colour'],
));
}
$db->sql_freeresult($result);
and then to index_body.html

Code: Select all

<!-- IF not S_IS_BOT -->
	<!-- BEGIN users --><div style="text-align:center;"><p>Vote <span style="font-weight:bold; color:#{users.BOT_COLOUR};">{users.BOT_NAME}</span> for President!</p></div><!-- END users -->
	<!-- ENDIF -->

Request

Post by martin123456 »

:thumb: :thumb: cheers buddy now i'm happy

Request

Post by Blackwolf »

:D Me too Thanks!!

My bots are #999900 any reason that it's not showing as that colour?

I assumed it would inherit the code ?

Code: Select all

'BOT_COLOUR'   => $row['user_colour'],
:?

Request

Post by Stoker »

Same here. But I never noticed :D
You can set a colour manually in the template.

Request

Post by Blackwolf »

Stoker wrote:Same here. But I never noticed :D
You can set a colour manually in the template.
;) Done :thumb:

Request

Post by Stoker »

Found the bug. Its in the index_body.html edit.
Find:

Code: Select all

{users.BOT_COLOUR}
Replace with:

Code: Select all

#{users.BOT_COLOUR}
First post updated.

Request

Post by Blackwolf »

:thumb: Thanks for the fast fix.

Request

Post by Stoker »

To display random users from a specific group change this code from index.php:

Code: Select all

WHERE user_type = 2
to

Code: Select all

WHERE group_id = 7
7 is the group ID

Request

Post by mikef35 »

Stoker wrote:To display random users from a specific group change this code from index.php:

Code: Select all

WHERE user_type = 2
to

Code: Select all

WHERE group_id = 7
7 is the group ID

That is not working, I have it set to 2 right now like in your code and it displays the random BOT, my bot group id is 6. So when I change it to a real group number I get nothing.