Pagina 1 di 2

Guida per rendere visibile l'ultima modifica ai post

Inviato: 06/05/2011, 22:02
da Shanks
Ho cercato il modo per far apparire sempre la scritta "ultima modifica" con data e nome di chi l'ha effettua ed ho trovato queste indicazioni:

Per far si che appaia sempre il messaggio di modifica si potrebbe modificare il codice come di seguito:
functions_posting.php

Codice: Seleziona tutto

case 'edit_topic': 

             // If edit reason is given always display edit info 

             // If editing last post then display no edit info 
             // If m_edit permission then display no edit info 
             // If normal edit display edit info 

             // Display edit info if edit reason given or user is editing his post, which is not the last within the topic. 
             if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post'))) 
             { 
                $sql_data[POSTS_TABLE]['sql'] = array( 
                   'post_edit_time'   => $current_time, 
                   'post_edit_reason'   => $data['post_edit_reason'], 
                   'post_edit_user'   => (int) $data['post_edit_user'], 
                ); 

                $sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1'; 
             } 
             else if (!$data['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data['forum_id'])) 
             { 
                $sql_data[POSTS_TABLE]['sql'] = array( 
                   'post_edit_reason'   => '', 
                ); 
             } 

             // If the person editing this post is different to the one having posted then we will add a log entry stating the edit 
             // Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods 
             if ($user->data['user_id'] != $poster_id) 
             { 
                $log_subject = ($subject) ? $subject : $data['topic_title']; 
                add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']); 
             } 

             if (!isset($sql_data[POSTS_TABLE]['sql']))
Lo sostituisci con

Codice: Seleziona tutto

case 'edit_topic': 

             // If edit reason is given always display edit info 

             // If editing last post then display no edit info 
             // If m_edit permission then display no edit info 
             // If normal edit display edit info 

             // Display edit info if edit reason given or user is editing his post, which is not the last within the topic. 
                $sql_data[POSTS_TABLE]['sql'] = array( 
                   'post_edit_time'   => $current_time, 
                   'post_edit_reason'   => $data['post_edit_reason'], 
                   'post_edit_user'   => (int) $data['post_edit_user'], 
                ); 

                $sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1'; 

             // If the person editing this post is different to the one having posted then we will add a log entry stating the edit 
             // Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods 
                   $log_subject = ($subject) ? $subject : $data['topic_title']; 
                add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']); 
              
             if (!isset($sql_data[POSTS_TABLE]['sql']))
Mi chiedevo se le indicazioni sono giuste e se questa modifica può creare qualche problema... ho provato in locale e non ho riscontrato malfunzionamenti ma voi che siete più esperti di me e forse avete già visto queste indicazioni sicuramente sapete dirmi di più...

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 07/05/2011, 16:45
da Carlo
Differenze tra i due pezzi di codice incollati? Non ne vedo.

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 07/05/2011, 17:40
da Shanks
Come? vengono rimosse queste due parti:

Codice: Seleziona tutto

             if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post')))
             { 

Codice: Seleziona tutto

             }
             else if (!$data['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data['forum_id']))
             {
                $sql_data[POSTS_TABLE]['sql'] = array(
                   'post_edit_reason'   => '',
                );
             } 
e alla fine del codice dopo

Codice: Seleziona tutto

// Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods 
ci sono alcune differenze...

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 07/05/2011, 17:50
da Carlo
Ma queste modifiche sul codice PHP le hai realizzate tu, o hai seguito una guida o una MOD?

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 07/05/2011, 18:03
da Shanks
Magari ne fossi capace :D Le ho trovate in rete, in qualche forum, un utente aveva esposto questa richiesta e gli era stato detto di apportare queste modifiche... Ho seguito una guida.

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 07/05/2011, 19:00
da Carlo
Beh, se le modifiche le hai provate in locale e funzionano, allora non ho niente in contrario. :mrgreen:

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 07/05/2011, 19:05
da Shanks
Ok :D Ti ringrazio, adesso modifico anche in remoto.

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 04/04/2012, 14:07
da Pentambo
Scusate ma lo si fa dal pannello di controllo o via ftp???

Chiedo perchè nei template non ho trovato questo file functions_posting.php


grazie

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 04/04/2012, 16:54
da Shanks
tramite ftp. il file functions_posting.php lo trovi in includes.
esegui il backup del file prima di applicare la mod, non si sa mai ;)

Re: Guida per rendere visibile l'ultima modifica ai post

Inviato: 04/04/2012, 21:40
da Pentambo
Perfetto funziona alla grande...