############################################################## ## MOD Title: Post_edit_all ## MOD Author: Merlin Sythove Dennis www.pimpmyforum.nl ## MOD Description: ## This mod will add a checkbox to the options in the post edit screen, ## that allows the post author to allow anyone else to edit that post. ## Who edited the post last, is shown. ## ## MOD Version: 0.9.0 ## ## Installation Level: (Easy) ## Installation Time: 15 Minutes ## Files To Edit: ## posting.php ## language/lang_english/lang_main.php ## templates/subSilver/posting_body.tpl ## includes/functions_post.php ## viewtopic.php ## Included Files: (N/A, or list of included files) ## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ############################################################## ## For security purposes, please check: http://www.phpbb.com/mods/ ## for the latest version of this MOD. Although MODs are checked ## before being allowed in the MODs Database there is no guarantee ## that there are no security problems within the MOD. No support ## will be given for MODs not found within the MODs Database which ## can be found at http://www.phpbb.com/mods/ ############################################################## ## Author Notes: ## ## MOD Discussion ## http://www.phpbb.com/community/viewtopic.php?f=16&t=530928&start=0&st=0&sk=t&sd=a ## ############################################################## ## MOD History: ## ## 2007/04/08 Vesion 0.9.0 ## - initial release ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ SQL ]------------------------------------------ # ALTER TABLE `phpbb_posts` ADD `post_edit_all` TINYINT( 1 ) NULL ; ALTER TABLE `phpbb_posts` ADD `post_edit_user_id` MEDIUMINT( 8 ) NULL ; # #-----[ OPEN ]------------------------------------------ # posting.php # #-----[ FIND PARTIAL]------------------------------------------ # $select_sql = (!$submit) ? ', t.topic_title, p.enable_bbcode, # #-----[ INLINE FIND ]------------------------------------------ # p.post_username, # #-----[ INLINE AFTER, ADD ]------------------------------------------ # p.post_edit_all, # #-----[ FIND ]------------------------------------------ # $message = ( $delete || $mode == 'delete' ) ? $lang['Delete_own_posts'] : $lang['Edit_own_posts']; # #-----[ REPLACE WITH ]------------------------------------------ # //MOD post_edit_all // only poster himself can delete this post $message = ( $delete || $mode == 'delete' ) ? $lang['Delete_own_posts'] : (! $post_info['post_edit_all'] ? $lang['Edit_own_posts'] : ''); if ($message) { # #-----[ FIND ]------------------------------------------ # These are just the next 2 lines $message .= '

' . sprintf($lang['Click_return_topic'], '', ''); message_die(GENERAL_MESSAGE, $message); # #-----[ AFTER, ADD ]------------------------------------------ # } # #-----[ FIND ]------------------------------------------ # // -------------------- // What shall we do? // # #-----[ BEFORE, ADD ]------------------------------------------ # //START MOD Post_edit_all //Do we have a checkbox on screen to set this toggle? $post_edit_all_checkbox = ($mode == 'newtopic' || $mode == 'quote' || $mode == 'reply' || ($mode == 'editpost' && ($post_info['poster_id'] == $userdata['user_id'] || $userdata['user_level'] > USER) ) ) ? true : false; //The value comes from the post that is edited, or it is zero to start with $post_data['post_edit_all'] = ($mode == 'editpost') ? $post_info['post_edit_all'] : 0; //If we are already editing, the value is in the checkbox (if we have one) if ($post_edit_all_checkbox && ($refresh || $confirm || $submit)) { $post_data['post_edit_all'] = ( isset($HTTP_POST_VARS['post_edit_all']) ) ? TRUE : false; } //Copy to variable - the $post_data array is used by submit_post, the variable is for on screen $post_edit_all = $post_data['post_edit_all']; //The first post in a renewed topic can be edited by all people at all times. //$post_edit_all = $post_edit_all || $topic_renew; //If instead you want this option only in a certain forum, like forum 2: //if ($forum_id == 2) $post_edit_all = $post_edit_all || $topic_renew; //END MOD Post_edit_all # #-----[ FIND ]------------------------------------------ # // // Signature toggle selection // # #-----[ BEFORE, ADD ]------------------------------------------ # //START MOD Post_edit_all toggle selection // If the user is the author, or mod or admin: then show toggle if ($post_edit_all_checkbox ) { $template->assign_block_vars('switch_post_edit_all_checkbox', array()); } //Set a variable to use to show other checkboxes if anyone else edits your post! $post_edit_all_auth = !($mode == 'editpost' && $post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod']); //END MOD Post_edit_all # NOTE: From here on downwards in posting.php, find "assign_block_vars('switch" # and decide if you want to hide such a checkbox if anyone but the author edits a post. # If so, prepend "if ($post_edit_all_auth) " to that line. # #-----[ FIND ]------------------------------------------ # $template->assign_block_vars('switch_signature_checkbox', array()); # #-----[ REPLACE BY ]------------------------------------------ # if ($post_edit_all_auth) $template->assign_block_vars('switch_signature_checkbox', array()); # #-----[ FIND ]------------------------------------------ # $template->assign_block_vars('switch_html_checkbox', array()); # #-----[ REPLACE BY ]------------------------------------------ # if ($post_edit_all_auth) $template->assign_block_vars('switch_html_checkbox', array()); # #-----[ FIND ]------------------------------------------ # $template->assign_block_vars('switch_bbcode_checkbox', array()); # #-----[ REPLACE BY ]------------------------------------------ # if ($post_edit_all_auth) $template->assign_block_vars('switch_bbcode_checkbox', array()); # #-----[ FIND ]------------------------------------------ # $template->assign_block_vars('switch_smilies_checkbox', array()); # #-----[ REPLACE BY ]------------------------------------------ # if ($post_edit_all_auth) $template->assign_block_vars('switch_smilies_checkbox', array()); # #-----[ FIND ]------------------------------------------ # $template->assign_block_vars('switch_notify_checkbox', array()); # #-----[ REPLACE BY ]------------------------------------------ # if ($post_edit_all_auth) $template->assign_block_vars('switch_notify_checkbox', array()); # #-----[ FIND ]------------------------------------------ # $template->assign_block_vars('switch_delete_checkbox', array()); # #-----[ REPLACE BY ]------------------------------------------ # if ($post_edit_all_auth) $template->assign_block_vars('switch_delete_checkbox', array()); # #-----[ FIND ]------------------------------------------ # if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) # #-----[ REPLACE BY ]------------------------------------------ # if ( $post_edit_all_auth && ($mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )) # #-----[ FIND ]------------------------------------------ # $template->assign_block_vars('switch_poll_delete_toggle', array()); # #-----[ REPLACE BY ]------------------------------------------ # if ($post_edit_all_auth) $template->assign_block_vars('switch_poll_delete_toggle', array()); # #-----[ FIND ]------------------------------------------ # if( !empty($poll_options) ) # #-----[ REPLACE BY ]------------------------------------------ # if( !empty($poll_options) && $post_edit_all_auth ) # #-----[ FIND ]------------------------------------------ # 'L_NOTIFY_ON_REPLY' => $lang['Notify'], # #-----[ AFTER, ADD ]------------------------------------------ # //MOD Post_edit_all 'L_POST_EDIT_ALL' => $lang['Post_edit_all'], 'S_POST_EDIT_ALL_CHECKED' => ( $post_edit_all ) ? 'checked="checked"' : '', # #-----[ OPEN ]------------------------------------------ # language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------------ # // // That's all, Folks! // ------------------------------------------------- # #-----[ BEFORE, ADD ]------------------------------------------ # //MOD Post_edit_all $lang['Post_edit_all'] = "Allow anyone to edit this post"; # #-----[ OPEN ]------------------------------------------ # templates/subSilver/posting_body.tpl # #-----[ FIND ]------------------------------------------ # # #-----[ AFTER, ADD ]------------------------------------------ # {L_POST_EDIT_ALL} # #-----[ OPEN ]------------------------------------------ # includes/functions_post.php # # #-----[ FIND PARTIAL LINE ]------------------------------------------ # $edited_sql = ($mode == 'editpost' && # #-----[ INLINE FIND ]------------------------------------------ # $post_data['poster_post']) # #-----[ AFTER, ADD ]------------------------------------------ # || $post_data['post_edit_all'] ) # #-----[ INLINE FIND ]------------------------------------------ # post_edit_count + 1 " # #-----[ AFTER, ADD ]------------------------------------------ # . ", post_edit_user_id = " . $userdata['user_id'] # #-----[ FIND PARTIAL LINE ]------------------------------------------ # $sql = ($mode != "editpost") ? "INSERT INTO " # #-----[ BEFORE, ADD ]------------------------------------------ # //MOD Post_edit_all //This variable is ONLY to be used in the SQL, it is useless for logical comparisons $post_edit_all = $post_data['post_edit_all'] ? true : 'NULL'; # #-----[ FIND PARTIAL LINE ]------------------------------------------ # $sql = ($mode != "editpost") ? "INSERT INTO " #-----[ INLINE FIND ]------------------------------------------ # , enable_sig # #-----[ AFTER, ADD ]------------------------------------------ # , post_edit_all # #-----[ INLINE FIND ]------------------------------------------ # , $attach_sig # #-----[ AFTER, ADD ]------------------------------------------ # , $post_edit_all # #-----[ INLINE FIND ]------------------------------------------ # , enable_sig = $attach_sig # #-----[ AFTER, ADD ]------------------------------------------ # , post_edit_all = $post_edit_all # #-----[ OPEN ]------------------------------------------ # viewtopic.php # #-----[ FIND ]------------------------------------------ # $l_edited_by = '

' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']); # #-----[ AFTER, ADD ]------------------------------------------ # //START MOD post_edit_all $editor_id = $postrow[$i]['post_edit_user_id']; if ($editor_id) { $sql = "SELECT username FROM " . USERS_TABLE . " WHERE user_id = $editor_id"; if ( $result = $db->sql_query($sql)) { if ($ed_row = $db->sql_fetchrow($result) ) { $edited_by = ( $editor_id != ANONYMOUS ) ? '' . $ed_row['username'] . '' : $lang['Guest']; $l_edited_by = '

' . sprintf($l_edit_time_total, $edited_by, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count'],1); } } } //END MOD post_edit_all # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM