Default Random 'No Avatar'

Con l'avvento della versione phpBB 3.1 Beta 2 e successive abbiamo rimosso tutte le MOD per sperimentare le estensioni.
Rispondi
Avatar utente
Darkman
Amministratore
Amministratore
Messaggi: 1204
Iscritto il: marzo 28, 2009, 11:04 pm

Default Random 'No Avatar'

Messaggio da Darkman »

Modification name: Default Random 'No Avatar'
Author: Boardtalk.net
Modification description: Random Avatars are displayed by default for users who have not selected an Avatar. Pack includes 17 ‘No Avatar’ images.

Contrib contains a sports set of avatars should you prefer a different set.

Many thanks to KillBill. for the assistance in making this modification.
Modification version: 1.0.4a
Tested on phpBB version: 3.0.8

download
http://www.phpbb.com/community/viewtopi ... &t=2123484

File copy

Copy: root/images/avatars/random/*.*
To: images/avatars/random/*.*

Open: includes/functions_display.php
Find:

Codice: Seleziona tutto

		return '';
	}
Replace with

Codice: Seleziona tutto

		$random_avatar = $phpbb_root_path . 'images/avatars/random/no_avatar' . mt_rand(1, 17) . '.gif';

		if (file_exists($random_avatar))
		{
			if (!$avatar_width && !$avatar_height)
			{
				if (list($width, $height) = @getimagesize($random_avatar))
				{
					$avatar_width  = $width;
					$avatar_height = $height;
				} 
				else
				{
					$avatar_width = $avatar_height = 100;
				}
			}

			return '<img src="' . $random_avatar . '" width="' . $avatar_width . '" height="' . $avatar_height . '" title="' . ((!empty($user->lang['RANDOM_AVATAR'])) ? $user->lang['RANDOM_AVATAR'] : 'RANDOM_AVATAR') . '" alt="' . ((!empty($user->lang['RANDOM_AVATAR'])) ? $user->lang['RANDOM_AVATAR'] : 'RANDOM_AVATAR') . '"/>';
		}
		else
		{
			return '';
		}
	}
Open: language/en/common.php

Find

Codice: Seleziona tutto

	'READING_FORUM'				=> 'Viewing topics in %s',
Add before

Codice: Seleziona tutto

	'RANDOM_AVATAR'				=> 'Random avatar',
Nella lingua it:

Codice: Seleziona tutto

	'RANDOM_AVATAR'				=> 'Avatar casuale',
Bella modifica rilasciata sul .com

In pratica mettere avatars casuali a chi non ce li ha rendendo molto simpatico l'aspetto degli argomenti.
Il pack comprende 17 gif ma ne aggiungerà altre.

si riprende amici e vai
Augusta
Utenti registrati
Utenti registrati
Messaggi: 23
Iscritto il: maggio 5, 2011, 6:49 pm

Re: Default Random 'No Avatar'

Messaggio da Augusta »

la sto vedendo all'opera, almeno credo, qui sul tuo forum visto che non ho ancora inserito l'avatar... (troppo grande, debbo ridimensionarlo, lo farò dopo...) e debbo dire che gli animaletti proposti sono davvero uno spasso! simpaticissimi! :lol:
Avatar utente
Darkman
Amministratore
Amministratore
Messaggi: 1204
Iscritto il: marzo 28, 2009, 11:04 pm

Re: Default Random 'No Avatar'

Messaggio da Darkman »

Augusta ha scritto:la sto vedendo all'opera, almeno credo, qui sul tuo forum visto che non ho ancora inserito l'avatar... (troppo grande, debbo ridimensionarlo, lo farò dopo...) e debbo dire che gli animaletti proposti sono davvero uno spasso! simpaticissimi! :lol:

vero cara amica, sono un pochino indietro qui indaffarato, come sai nelle traduzioni.
Avatar utente
Darkman
Amministratore
Amministratore
Messaggi: 1204
Iscritto il: marzo 28, 2009, 11:04 pm

Re: Default Random 'No Avatar'

Messaggio da Darkman »

Per integrare nella mchat
RMcGirr83 ha scritto:You can have the Random Avatar mod incorporated into the mchat mod. You MUST have the random avatar mod installed on your forum for this to work.

Open

mchat.php

[install]Find This may be a partial find and not the whole line

Codice: Seleziona tutto

$mchat_avatar =
[/install]
[install]Replace with Replace the preceding lines with the following

Codice: Seleziona tutto

				$random_avatar = $phpbb_root_path . 'images/avatars/random/no_avatar' . mt_rand(1, 17) . '.gif';
				$mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="' . $random_avatar . '" width="40" height="40" alt="Random Avatar" />';
[/install]
[install]Find This may be a partial find and not the whole line

Codice: Seleziona tutto

$mchat_avatar =
[/install]
[install]Replace with Replace the preceding lines with the following

Codice: Seleziona tutto

$random_avatar = $phpbb_root_path . 'images/avatars/random/no_avatar' . mt_rand(1, 17) . '.gif';
			$mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="' . $random_avatar . '" width="40" height="40" alt="Random Avatar" />';
[/install]
[install]Find This may be a partial find and not the whole line

Codice: Seleziona tutto

$mchat_avatar =
[/install]
[install]Replace with Replace the preceding lines with the following

Codice: Seleziona tutto

$random_avatar = $phpbb_root_path . 'images/avatars/random/no_avatar' . mt_rand(1, 17) . '.gif';
		$mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="' . $random_avatar . '" width="40" height="40" alt="Random Avatar" />';
[/install]
[install]Find This may be a partial find and not the whole line

Codice: Seleziona tutto

$mchat_avatar =
[/install]

[install]Replace with Replace the preceding lines with the following

Codice: Seleziona tutto

				$random_avatar = $phpbb_root_path . 'images/avatars/random/no_avatar' . mt_rand(1, 17) . '.gif';
				// END random avatar
				$mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="' . $random_avatar . '" width="40" height="40" alt="Random Avatar" />';
[/install]

Few notes
  • the finds above are not complete finds. When you find the code given, you need to replace the entire line with the "replace with"
  • the random avatar mod comes with 17 avatars, if you have more avatars you want to use then upload them into the random avatar directory and change the number 17 within the mt_rand function
Rispondi