phpBB Italia chiude!
phpBB Italia ringrazia tutti gli utenti che hanno dato fiducia al nostro progetto per ben 9 anni, e che, grazie al grande lavoro fatto da tutto lo Staff (rigorosamente a titolo gratuito), hanno portato il portale a diventare il principale punto di riferimento italiano alla piattaforma phpBB.

Purtroppo, causa motivi personali, non ho più modo di gestirlo e portarlo avanti. Il forum viene ora posto in uno stato di sola lettura, nonché un archivio storico per permettere a chiunque di fruire di tutte le discussioni trattate.

Il nuovo portale di assistenza per l'Italia di phpBB diventa phpBB-Store.it, cui ringrazio per aver deciso di portare avanti questo grande progetto.

Grazie ancora,
Carlo - Amministratore di phpBB Italia

Welcome MOD

Supporto MODs generale.
Avatar utente
Haku
Utente
Utente
Messaggi: 2529
Iscritto il: 22/09/2009, 22:36
Sesso: Maschio
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Welcome MOD

Messaggio da Haku » 19/08/2011, 17:45

Intanto grazie dei codici, sono davvero molti utili e li metterò in atto sicuramente =D

Allora, le modifiche da me fatte per la welcome MOD, sono queste:
file index.php
trova

Codice: Seleziona tutto

    // Assign index specific vars
e dopo ho aggiunto:

Codice: Seleziona tutto

    // BEGIN Welcome Mod
    //--Welcome_Mod--get the hour number-->
    $date = $user->format_date(time(), 'H');

    if ($user->data['is_registered'])
    {
        $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
    }
    else
    {
        $u_user_name = $user->lang['WELCOME_GUEST'];
    }   

    switch (true)
    {
            case ($date < 1):
                // if the hour is 6pm-11pm (18-23)
                $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
            break;
         
          case ($date < 4):
                // if the hour is 1-3 am
                $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
            break;
           
            case ($date < 8):
                // if the hour is 4-7 am
                $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
            break;
           
            case ($date < 12):
                // if the hour is 8-11 am
                $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
            break;
           
            case ($date < 18):
                // if the hour is 12-5pm (12-17)
                $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
            break;
           
            case ($date < 24):
                // if the hour is 6pm-11pm (18-23_
                $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
            break;
    }

    // how long a member for
    $member_for = '';
    if ($user->data['is_registered'] && !$user->data['is_bot'])
    {
        $member_length = time() - $user->data['user_regdate'];
        $years = $months = $days = 0;
        $member_for = '';
        if ($member_length)
        {   
            if ($member_length >= 31536000)
            {
                $years = floor($member_length / 31536000);
                $member_length = $member_length - ($years * 31536000);
                $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
            }
            $months = floor($member_length / 2628000);
            if ($months)
            {
                $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
                $member_length = $member_length - ($months * 2628000);
                $member_for .= $months;
            }
            $days = floor($member_length / 86400);
            if ($days)
            {
                $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
                $member_for .= $days;
            }       
        }
    }
    //END Welcome Mod
trova:

Codice: Seleziona tutto

    'LEGEND'      => $legend,
e dopo ho aggiunto:

Codice: Seleziona tutto

        // BEGIN Welcome Mod   
            'S_WELCOME'                   => $s_welcome,
            'S_JOINED_DATE'               => $user->lang['JOINED'] . ':&nbsp;' . $user->format_date($user->data['user_regdate']),
            'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
            'MEMBER_FOR'               => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . '&nbsp;' . $member_for : '',
           // END Welcome Mod 
language/it/common.php
prima di:

Codice: Seleziona tutto

    ?>
ho aggiunto:

Codice: Seleziona tutto

        // BEGIN Welcome Mod
        $lang = array_merge($lang, array(
            'UP_LATE'             => 'Sei in ritardo %1$s, Dove ti eri addormentato?!',
            'UP_EARLY'             => 'Buon Giorno %1$s, Venuto presto stamattina eh?!',
            'GOOD_MORNING'           => 'Buon Giorno %1$s, Che mattina meravigliosa!',
            'GOOD_AFTERNOON'       => 'Buon Pomeriggio %1$s, Finalmente sei qui',
            'GOOD_EVENING'           => 'Buona Sera %1$s, E\' un piacere vederti qui',
           'GOOD_NIGHT'           => 'Buona Notte %1$s, E\' ora di andare a letto',
            'MEMBER_FOR'           => 'Iscritto da:',
            'WELCOME_GUEST'           => 'Ospite',
            'WELCOME_HOUR'           => 'Ora',
            'WELCOME_HOURS'           => 'Ore',
           'WELCOME_DAY'           => 'Giorno',
            'WELCOME_DAYS'           => 'Giorni',
            'WELCOME_MONTH'           => 'Mese',
            'WELCOME_MONTHS'       => 'Mesi',
           'WELCOME_YEAR'           => 'Anno',
            'WELCOME_YEARS'           => 'Anni',
        ));
        // END Welcome Mod
styles/prosilver/template/index_body.html
dopo:

Codice: Seleziona tutto

    <!-- INCLUDE overall_header.html -->
ho aggiunto:

Codice: Seleziona tutto

    <!-- IF not S_IS_BOT -->
    <div class="forabg">
             <div class="inner"><span class="corners-top"><span></span></span>
             <ul class="topiclist">
                <li class="header">
                   <dl class="icon">
                      <dt>Benvenuti in {SITENAME}</dt>
                                                  </dl>
                </li>
             </ul>
             <ul class="topiclist forums">
             <li>
                <dl>
                   <dd style="padding:5px; text-align: center; border:none;">
                   <!-- IF USER_AVATAR -->{USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif"/><!-- ENDIF -->
                   </dd>
                   <dd class="lastpost" style="padding:5px; width:40%;">
                   <p>{S_WELCOME}</p>
                   <span><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<br />{CURRENT_TIME}<!-- ELSE -->{CURRENT_TIME}<!-- ENDIF --><!-- IF S_USER_LOGGED_IN --><br /><br />{S_JOINED_DATE}<br />{MEMBER_FOR}<!-- ENDIF --></span>
                   </dd>
                   <dd class="lastpost" style="padding:5px; width:36%;"><span>{TOTAL_POSTS} &bull; {TOTAL_TOPICS}<br />{TOTAL_USERS}<br />{NEWEST_USER}
                   <!-- IF S_DISPLAY_ONLINE_LIST --><br /><br />{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<!-- ENDIF --></span>
                   </dd>
                </dl>
             </li>
             </ul>
    <span class="corners-bottom"><span></span></span></div></div>
    <!-- ENDIF -->
Sostituito poi questo:

Codice: Seleziona tutto

    <p class="{S_CONTENT_FLOW_END}<!-- IF S_USER_LOGGED_IN --> rightside<!-- ENDIF -->"><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<!-- ELSE -->{CURRENT_TIME}<!-- ENDIF --></p>
        <!-- IF U_MCP --><p>{CURRENT_TIME} <br />[&nbsp;<a href="{U_MCP}">{L_MCP}</a>&nbsp;]</p><!-- ELSEIF S_USER_LOGGED_IN --><p>{CURRENT_TIME}</p><!-- ENDIF -->
Con questo:

Codice: Seleziona tutto

    <!-- IF U_MCP --><p>[&nbsp;<a href="{U_MCP}">{L_MCP}</a>&nbsp;]</p><!-- ENDIF -->
Fin qui la MOD è strutturata in questo modo, niente di più.
La modifica dell'autoresize abbiamo fatto così:
In index.php ho sostituito:

Codice: Seleziona tutto

    //END Welcome Mod
con:

Codice: Seleziona tutto

       
    // funzione autoriduzione avatar
    $my_avatar = $user->data['user_avatar'];
    $my_avatar_type = $user->data['user_avatar_type'];
    $my_avatar_width = $user->data['user_avatar_width'];
    $my_avatar_height = $user->data['user_avatar_height'];

    if ($my_avatar_width > 100 || $my_avatar_height > 100)
    {
       if ($my_avatar_width > $my_avatar_height)
       {
          $my_avatar_height = ($my_avatar_height * 100) / $my_avatar_width;
          $my_avatar_width = 100;
       }
       elseif ($my_avatar_height > $my_avatar_width)
       {
          $my_avatar_width = ($my_avatar_width * 100) / $my_avatar_height;
          $my_avatar_height = 100;
       }
    }
    // funzione autoriduzione avatar

    //END Welcome Mod
Trova:

Codice: Seleziona tutto

    'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
sostituito con:

Codice: Seleziona tutto

            //'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
          'USER_AVATAR'               => get_user_avatar($my_avatar, $my_avatar_type, $my_avatar_width, $my_avatar_height),
Se non sbaglio poi c'era la piccola modifichina effettuata da te per avere due avatar differenti, uno di benvenuto, e dopo il login quello standard per chi ha nessun avatar...si trova topic dietro comunque.
Se mi dai una mano te ne sarei gratissimo bingo (anche agli altri)...perchè fino adesso non ho ricavato un ragno dal buco °_°

Avatar utente
Micogian
Leader Programmatori
Leader Programmatori
Messaggi: 3704
Iscritto il: 07/01/2010, 8:51
Versione: 3.2.0
Server: UNIX/Linux
PHP: 5.4.36
Database: MySQL 5.1.70-log
Località: Udine
Contatta:

Re: Welcome MOD

Messaggio da Micogian » 19/08/2011, 18:33

Secondo me, senza bisogno di creare un valore $my_avatar_width si potrebbe modificare il valore di default $user->data['avatar_width'] prima della creazione della variabile.
Il codice da me postato va bene ma va messo nel file index.php con una piccola modifica, al posto di $row usare $user->data:

Codice: Seleziona tutto

   // Ridimensiona Avatar se superiore di 140 px
   if ($user->data['user_avatar_width'] > 140 )
   {
   $user->data[user_avatar_height'] = ($user->data['user_avatar_height'] * 140 /  $user->data['user_avatar_width']);
   $user->data['user_avatar_width'] = 140 ;   
   }
   // fine ridimensiona Avatar
Adesso non ricordo se la variabile sia $user->data['avatar_width'] oppure $user->data['user_avatar_width']
Attenzione, è importante che venga prima modificato il valore "height" che viene calcolato in percentiale del valore "width" e poi stabilire la dimensione di "width".
Con questa modifica fatta prima della creazione delle variabili la variabile USER_AVATAR non ha bisogno di essere modificata perchè prende le nuove dimensioni.

Codice: Seleziona tutto

    'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
In sostanza, se le dimensioni le modifichi prima la Variabile resta quella originale.

Avatar utente
Haku
Utente
Utente
Messaggi: 2529
Iscritto il: 22/09/2009, 22:36
Sesso: Maschio
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Welcome MOD

Messaggio da Haku » 20/08/2011, 14:18

Quindi fammi capire...in index.php al posto di:

Codice: Seleziona tutto

           
        // funzione autoriduzione avatar
        $my_avatar = $user->data['user_avatar'];
        $my_avatar_type = $user->data['user_avatar_type'];
        $my_avatar_width = $user->data['user_avatar_width'];
        $my_avatar_height = $user->data['user_avatar_height'];

        if ($my_avatar_width > 100 || $my_avatar_height > 100)
        {
           if ($my_avatar_width > $my_avatar_height)
           {
              $my_avatar_height = ($my_avatar_height * 100) / $my_avatar_width;
              $my_avatar_width = 100;
           }
           elseif ($my_avatar_height > $my_avatar_width)
           {
              $my_avatar_width = ($my_avatar_width * 100) / $my_avatar_height;
              $my_avatar_height = 100;
           }
        }
        // funzione autoriduzione avatar

        //END Welcome Mod
devo inserire il tuo:

Codice: Seleziona tutto

       // Ridimensiona Avatar se superiore di 140 px
       if ($user->data['user_avatar_width'] > 140 )
       {
       $user->data[user_avatar_height'] = ($user->data['user_avatar_height'] * 140 /  $user->data['user_avatar_width']);
       $user->data['user_avatar_width'] = 140 ;   
       }
       // fine ridimensiona Avatar
e poi al posto di:

Codice: Seleziona tutto

                //'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
              'USER_AVATAR'               => get_user_avatar($my_avatar, $my_avatar_type, $my_avatar_width, $my_avatar_height),
questo?

Codice: Seleziona tutto

        'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),

Avatar utente
Micogian
Leader Programmatori
Leader Programmatori
Messaggi: 3704
Iscritto il: 07/01/2010, 8:51
Versione: 3.2.0
Server: UNIX/Linux
PHP: 5.4.36
Database: MySQL 5.1.70-log
Località: Udine
Contatta:

Re: Welcome MOD

Messaggio da Micogian » 20/08/2011, 15:09

Si, se l'avatar è rappresentato dalla variabile USER_AVATAR, questa è il risultato della funzione get_user_avatar alla quale vengono passati i dati modificati delle dimensioni:

Codice: Seleziona tutto

 'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
L'avatar sarà della dimensione stabilita da $user->data['user_avatar_width'] e $user->data['user_avatar_height']

Il problema potrebbe sorgere solo se l'utente non ha un avatar, in questo caso si può intervenire sia in sede di php oppure nel template stesso con un

Codice: Seleziona tutto

<!-- IF USER_AVATAR -->{USER_AVATAR}<!-- else -->{DEFAULT_AVATAR}<!-- ENDIF -->
La variabile DEFAULT_AVATAR la crei nel file php, dopo USER_AVATAR ma si potrebbe anche utilizzare la stessa variabile USER_AVATAR, mi sembra usando i due punti come alternativa:

Codice: Seleziona tutto

 'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']) : $default_avatar ,
Creando prima il valore di $default_avatar. Se non c'è la prima viene presa la seconda.

Avatar utente
Haku
Utente
Utente
Messaggi: 2529
Iscritto il: 22/09/2009, 22:36
Sesso: Maschio
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Welcome MOD

Messaggio da Haku » 20/08/2011, 15:10

faccio una prova e ti dico ;)

EDIT:
Deve esserci un'errore nel primo codice perchè me lo segna tutto grigio sballando i colori su notepad ^^

EDIT 2:
Mancava un'apice...ora provo.

Avatar utente
Haku
Utente
Utente
Messaggi: 2529
Iscritto il: 22/09/2009, 22:36
Sesso: Maschio
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Welcome MOD

Messaggio da Haku » 20/08/2011, 15:19

Purtroppo nulla...ho provato a caricare un'avatar di dimensioni massime, ma rimane come nello screen di topic addietro..

Avatar utente
Haku
Utente
Utente
Messaggi: 2529
Iscritto il: 22/09/2009, 22:36
Sesso: Maschio
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Welcome MOD

Messaggio da Haku » 22/08/2011, 22:08

Forse sbaglio io i codici, ma nel template index_body.html ho questo:

Codice: Seleziona tutto

<!-- IF AVATAR_COR == '' --><img src="{T_THEME_PATH}/images/Guest.gif" alt="" /><!-- ELSE -->{NEW_USER_AVATAR}<!-- ENDIF -->
E nell'index questo (variabile quindi rinominata in NEW_USER etc):

Codice: Seleziona tutto

'NEW_USER_AVATAR'             => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']), 
Ho messo un avatar di 150x150px, ma nulla.
Sborda sempre e non si autoridimensiona :/

Avatar utente
Micogian
Leader Programmatori
Leader Programmatori
Messaggi: 3704
Iscritto il: 07/01/2010, 8:51
Versione: 3.2.0
Server: UNIX/Linux
PHP: 5.4.36
Database: MySQL 5.1.70-log
Località: Udine
Contatta:

Re: Welcome MOD

Messaggio da Micogian » 22/08/2011, 23:10

Il tutto è molto semplice, la variabile USER_AVATAR o NEW_USER_AVATAR è il risultato della function get_user_avatar-
Questa function ha bisogno di 4 valori: il nome, il tipo di file, la dimensione width e quella height:

Codice: Seleziona tutto

'NEW_USER_AVATAR'             => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']), 
Che la variabile si chiami USER_AVATAR o NEW_USER_AVATAR non cambia nulla, basta che quella indicata nel file php sia la stessa utilizzata nel template.

Ora il problema sta nella dimensione, quindi il valore deve cambiare "prima" della creazione della variabile, modificando i valori di $user->data['user_avatar_width'] e $user->data['user_avatar_height'], modifica che si fa con:

Codice: Seleziona tutto

   // Ridimensiona Avatar se superiore di 140 px
   if ($user->data['user_avatar_width'] > 140 )
   {
   $user->data[user_avatar_height'] = ($user->data['user_avatar_height'] * 140 /  $user->data['user_avatar_width']);
   $user->data['user_avatar_width'] = 140 ;   
   }
   // fine ridimensiona Avatar
Questo codice va messo nel file index.php prima delle variabili e della function get_user_avatar che a questo punto prenderà le nuove dimensioni. Che sia USER_AVATAR o NEW_USER_AVATAR poco importa, se non che devi scegliere una o l'altra.

Il codice utilizzato nel template è giusto salvo il fatto che bisogna vedere se e dove viene creata la variabile AVATAR_COR:

Codice: Seleziona tutto

<!-- IF AVATAR_COR == '' --><img src="{T_THEME_PATH}/images/Guest.gif" alt="" /><!-- ELSE -->{NEW_USER_AVATAR}<!-- ENDIF -->
Insomma, a me sembra che hai fatto un pò di confusione con questo AVATAR e che hai del codice inutile.

In parole povere , il file php serve per creare le variabili, il template per usarle.

Avatar utente
Haku
Utente
Utente
Messaggi: 2529
Iscritto il: 22/09/2009, 22:36
Sesso: Maschio
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Welcome MOD

Messaggio da Haku » 22/08/2011, 23:23

Allora, la variabile AVATAR_COR me la avevi fatta creare tu per avere avatar differenti per i guest e per quelli registrati che non hanno avatar ^^

Ora, questo è il mio index, ho fatto come hai detto tu:

Codice: Seleziona tutto

<?php
/**
*
* @package phpBB3
* @version $Id: index.php 9614 2009-06-18 11:04:54Z nickvergessen $
* @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);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

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

display_forums('', $config['load_moderators']);

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts	= $config['num_posts'];
$total_topics	= $config['num_topics'];
$total_users	= $config['num_users'];

$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';

// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
	$sql = 'SELECT group_id, group_name, group_colour, group_type
		FROM ' . GROUPS_TABLE . '
		WHERE group_legend = 1
		ORDER BY group_name ASC';
}
else
{
	$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
		FROM ' . GROUPS_TABLE . ' g
		LEFT JOIN ' . USER_GROUP_TABLE . ' ug
			ON (
				g.group_id = ug.group_id
				AND ug.user_id = ' . $user->data['user_id'] . '
				AND ug.user_pending = 0
			)
		WHERE g.group_legend = 1
			AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
		ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
	$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];

	if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
	{
		$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
	}
	else
	{
			// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		$phpbb_seo->prepare_url('group', $row['group_name'], $row['group_id']);
		// www.phpBB-SEO.com SEO TOOLKIT END
		$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
	}
}
$db->sql_freeresult($result);

$legend = implode(', ', $legend);

// Generate birthday list if required ...
$birthday_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
	$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
	$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
		FROM ' . USERS_TABLE . ' u
		LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
		WHERE (b.ban_id IS NULL
			OR b.ban_exclude = 1)
			AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
			AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
	$result = $db->sql_query($sql);

	while ($row = $db->sql_fetchrow($result))
	{
		$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

		if ($age = (int) substr($row['user_birthday'], -4))
		{
			$birthday_list .= ' (' . ($now['year'] - $age) . ')';
		}
	}
	$db->sql_freeresult($result);
}

    // BEGIN Welcome Mod
    //--Welcome_Mod--get the hour number-->
    $date = $user->format_date(time(), 'H');

    if ($user->data['is_registered'])
    {
        $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
    }
    else
    {
        $u_user_name = $user->lang['WELCOME_GUEST'];
    }   

    switch (true)
    {
            case ($date < 1):
                // if the hour is 6pm-11pm (18-23)
                $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
            break;
          
          case ($date < 4):
                // if the hour is 1-3 am
                $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
            break;
           
            case ($date < 8):
                // if the hour is 4-7 am
                $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
            break;
           
            case ($date < 12):
                // if the hour is 8-11 am
                $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
            break;
           
            case ($date < 18):
                // if the hour is 12-5pm (12-17)
                $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
            break;
           
            case ($date < 24):
                // if the hour is 6pm-11pm (18-23_
                $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
            break;
    } 

    // how long a member for
    $member_for = '';
    if ($user->data['is_registered'] && !$user->data['is_bot'])
    {
        $member_length = time() - $user->data['user_regdate'];
        $years = $months = $days = 0;
        $member_for = '';
        if ($member_length)
        {   
            if ($member_length >= 31536000)
            {
                $years = floor($member_length / 31536000);
                $member_length = $member_length - ($years * 31536000);
                $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
            }
            $months = floor($member_length / 2628000);
            if ($months)
            {
                $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
                $member_length = $member_length - ($months * 2628000);
                $member_for .= $months;
            }
            $days = floor($member_length / 86400);
            if ($days)
            {
                $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
                $member_for .= $days;
            }       
        }
    }
       
    // funzione autoriduzione avatar
    if ($user->data['user_avatar_width'] > 151 )
       {
       $user->data['user_avatar_height'] = ($user->data['user_avatar_height'] * 140 /  $user->data['user_avatar_width']);
       $user->data['user_avatar_width'] = 151 ;   
       }
    // funzione autoriduzione avatar

    //END Welcome Mod
	if (class_exists('phpbb_gallery_integration'))
{
	phpbb_gallery_integration::index_total_images();
}

// Assign index specific vars
$template->assign_vars(array(
	'TOTAL_POSTS'	=> sprintf($user->lang[$l_total_post_s], $total_posts),
	'TOTAL_TOPICS'	=> sprintf($user->lang[$l_total_topic_s], $total_topics),
	'TOTAL_USERS'	=> sprintf($user->lang[$l_total_user_s], $total_users),
	'NEWEST_USER'	=> sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),

	    // BEGIN Welcome Mod   
        'S_WELCOME'                   => $s_welcome,
        'S_JOINED_DATE'               => $user->lang['JOINED'] . ':&nbsp;' . $user->format_date($user->data['user_regdate']),
        //'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
        'NEW_USER_AVATAR'             => get_user_avatar($my_avatar, $my_avatar_type, $my_avatar_width, $my_avatar_height),
        'MEMBER_FOR'                  => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . '&nbsp;' . $member_for : '',
       // END Welcome Mod 
	'LEGEND'		=> $legend,
	'BIRTHDAY_LIST'	=> $birthday_list,

	'FORUM_IMG'				=> $user->img('forum_read', 'NO_UNREAD_POSTS'),
	'FORUM_UNREAD_IMG'			=> $user->img('forum_unread', 'UNREAD_POSTS'),
	'FORUM_LOCKED_IMG'		=> $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'),
	'FORUM_UNREAD_LOCKED_IMG'	=> $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'),

	'S_LOGIN_ACTION'			=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
	'S_DISPLAY_BIRTHDAY_LIST'	=> ($config['load_birthdays']) ? true : false,

	'U_MARK_FORUMS'		=> ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
	'U_MCP'				=> ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);

include($phpbb_root_path . 'includes/functions_activity_stats.' . $phpEx);
activity_mod();

// Start DM Video
if ( isset($config['dm_video_version']) )
{
	$user->setup('mods/dm_video');

	$sql = 'SELECT COUNT(video_id) AS number_videos
	    FROM ' . DM_VIDEO_TABLE . '
	    WHERE video_approval = 1';
	$result = $db->sql_query($sql);
	$row = $db->sql_fetchrow($result);

	$sql2 = 'SELECT *
		FROM ' . DM_VIDEO_TABLE . '
		WHERE video_approval = 1
		ORDER BY video_counter DESC LIMIT 5';
	$result2 = $db->sql_query($sql2);

	while ( $row2 = $db->sql_fetchrow($result2) )
	{	
		$template->assign_block_vars('videoline', array(
			'VIDEO_COUNTER' => sprintf($user->lang['DMV_VIDEO_COUNTER'], $row2['video_counter']),
			'TITEL'			=> $row2['video_title'],
		));  
	}
	$db->sql_freeresult($result);

	$template->assign_vars(array(
		'S_VIDEO_EXIST'	=> true,
		'NUMBER_VIDEOS'	=> sprintf($user->lang['DMV_TOTAL_VIDEOS'], $row['number_videos']),
	));
}
// End DM Video

include($phpbb_root_path . 'mod_topten_topics.' . $phpEx); 
// Output page
// www.phpBB-SEO.com SEO TOOLKIT BEGIN - META
$seo_meta->collect('description', $config['sitename'] . ' : ' .  $config['site_desc']);
$seo_meta->collect('keywords', $config['sitename'] . ' ' . $seo_meta->meta['description']);
// www.phpBB-SEO.com SEO TOOLKIT END - META


// www.phpBB-SEO.com SEO TOOLKIT BEGIN - TITLE
page_header($config['sitename']);
// www.phpBB-SEO.com SEO TOOLKIT END - TITLE

$template->set_filenames(array(
	'body' => 'index_body.html')
);

page_footer();

?>

Avatar utente
Micogian
Leader Programmatori
Leader Programmatori
Messaggi: 3704
Iscritto il: 07/01/2010, 8:51
Versione: 3.2.0
Server: UNIX/Linux
PHP: 5.4.36
Database: MySQL 5.1.70-log
Località: Udine
Contatta:

Re: Welcome MOD

Messaggio da Micogian » 22/08/2011, 23:46

Prima di tutto la variabile AVATAR_COR non c'è nell'index. E' probabile che sia in qualche file functions, ma bisogna esserne sicuri.
Poi ti ho spiegato che la variabile USER_AVATAR o nel tuo caso NEW_USER_AVATAR è il risultato della function get_user_avatar() con 4 valori da inserire.
Ora, dove stanno i valori di my_avatar_width e gli altri ?
I valori disponibili in index (almeno credo) sono $user->data['user_avatar_width'] e simili.
Usa pertanto la variabile USER_AVATAR e lascia perdere NEW_USER_AVATAR
Nel template utilizza USER_AVATAR ma va controllato che AVATAR_COR esista

Rispondi

Torna a “Supporto MODs”

Chi c’è in linea

Visitano il forum: Nessuno e 109 ospiti