################################################################# ## Mod Title: Dates For Humans ## Mod Version: 1.0.1 ## Author: Lars Janssen - http://www.ukmix.org/ ## Thanks to Farell aka Laurent Laville ## for several enhancements. ## Description: Allows users to select their date format from a pre-defined ## selection of examples, rather than asking non-programmers to ## play with PHP date codes. ## ## Installation Level: moderate ## Installation Time: 15 minutes (longer if you create your own date formats) ## Files To Edit: 7 ## includes/functions_selects.php ## includes/usercp_register.php ## admin/admin_users.php ## admin/admin_board.php ## templates/subSilver/admin/board_config_body.tpl ## templates/subSilver/admin/user_edit_body.tpl ## templates/subSilver/profile_add_body.tpl ## Included Files: n/a ## phpBB version: 2.0.1 (likely to work on 2.0.x but not tested) ################################################################# ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This file contains instructions for modifying the phpBB software ## (not supplied), (C) 2001 The phpBB Group - http://www.phpbb.com/, ## and includes short code excerpts for the purpose of locating change points. ################################################################# ## Author Note: ## ## I suspect on most forums, 99% of users will leave the default date option ## of "D M d, Y g:i a" alone - even if they would prefer another date format. ## This mod lets them choose from a drop-down menu - easier for humans. ;-) ## You can add your own formats to the $date_formats array in the code below - ## see http://www.php.net/date for details about the format. ## New in v1.0.1 - extra files added so it should now work throughout the ## forums (especially admin areas). ################################################################# ## Before adding this mod to your forum, you should back up all related files. ################################################################# ##### - Template alterations - #### # Some of the directions are given for SubSilver, use as a guide for other templates # # #-----[ OPEN ]------------------------------------------ # includes/usercp_register.php # #-----[ FIND ]------------------------------------------ # 'DATE_FORMAT' => $user_dateformat, # #-----[ REPLACE WITH ]------------------------------------------ # 'DATE_FORMAT_SELECT' => date_format_select($user_dateformat, $user_timezone), # #-----[ OPEN ]------------------------------------------ # admin/admin_users.php # #-----[ FIND ]------------------------------------------ # 'DATE_FORMAT' => $user_dateformat, # #-----[ REPLACE WITH ]------------------------------------------ # 'DATE_FORMAT_SELECT' => date_format_select($user_dateformat, $user_timezone), # #-----[ OPEN ]------------------------------------------ # admin/admin_board.php # #-----[ FIND ]------------------------------------------ # "DEFAULT_DATEFORMAT" => $new['default_dateformat'], # #-----[ REPLACE WITH ]------------------------------------------ # "DEFAULT_DATEFORMAT" => admin_date_format_select($new['default_dateformat'], $timezone_select), # #-----[ OPEN ]------------------------------------------ # templates/subSilver/admin/board_config_body.tpl # #-----[ FIND ]------------------------------------------ # {L_DATE_FORMAT}
{L_DATE_FORMAT_EXPLAIN} # #-----[ REPLACE WITH ]------------------------------------------ # {L_DATE_FORMAT} {DEFAULT_DATEFORMAT} # #-----[ OPEN ]------------------------------------------ # templates/subSilver/profile_add_body.tpl # #-----[ FIND ]------------------------------------------ # {L_DATE_FORMAT}:
{L_DATE_FORMAT_EXPLAIN} # #-----[ REPLACE WITH ]------------------------------------------ # {L_DATE_FORMAT}: {DATE_FORMAT_SELECT} # #-----[ OPEN ]------------------------------------------ # templates/subSilver/admin/user_edit_body.tpl # #-----[ FIND ]------------------------------------------ # {L_DATE_FORMAT}:
{L_DATE_FORMAT_EXPLAIN} # #-----[ REPLACE WITH ]------------------------------------------ # {L_DATE_FORMAT} {DATE_FORMAT_SELECT} # #-----[ OPEN ]------------------------------------------ # includes/functions_selects.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # // // Pick a (canned) date format // function date_format_select($default, $timezone, $select_name = 'dateformat') { global $board_config; // Include any valid PHP date format strings here, in your preferred order $date_formats = array( 'D d M, Y', 'D d M, Y g:i a', 'D d M, Y H:i', 'D M d, Y', 'D M d, Y g:i a', 'D M d, Y H:i', 'jS F Y', 'jS F Y, g:i a', 'jS F Y, H:i', 'F jS Y', 'F jS Y, g:i a', 'F jS Y, H:i', 'j/n/Y', 'j/n/Y, g:i a', 'j/n/Y, H:i', 'n/j/Y', 'n/j/Y, g:i a', 'n/j/Y, H:i', 'Y-m-d', 'Y-m-d, g:i a', 'Y-m-d, H:i' ); if ( !isset($timezone) ) { $timezone == $board_config['board_timezone']; } $now = time() + (3600 * $timezone); $df_select = ''; return $df_select; } function admin_date_format_select($default, $timezone, $select_name = 'default_dateformat') { global $board_config; // Include any valid PHP date format strings here, in your preferred order $date_formats = array( 'D d M, Y', 'D d M, Y g:i a', 'D d M, Y H:i', 'D M d, Y', 'D M d, Y g:i a', 'D M d, Y H:i', 'D jS M g:i a', 'D jS M H:i', 'jS F Y', 'jS F Y, g:i a', 'jS F Y, H:i', 'F jS Y', 'F jS Y, g:i a', 'F jS Y, H:i', 'j/n/Y', 'j/n/Y, g:i a', 'j/n/Y, H:i', 'n/j/Y', 'n/j/Y, g:i a', 'n/j/Y, H:i', 'Y-m-d', 'Y-m-d, g:i a', 'Y-m-d, H:i' ); if ( !isset($timezone) ) { $timezone == $board_config['board_timezone']; } $now = time() + (3600 * $timezone); $df_select = ''; return $df_select; } # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM