[BETA] ADD DST in phpBB

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
Remix_88
Registered User
Posts: 46
Joined: Wed Apr 23, 2003 12:52 pm
Location: Hampshire, UK

Post by Remix_88 »

mtcrowe, your code works very nicely. Thank you. I don't know whay the original MOD have anything in board_config because it doesn't actually do anything.

However, in your version of the MOD the following line...

Code: Select all

$user_dst=( isset($HTTP_POST_VARS['dst']) ) ? intval($HTTP_POST_VARS['dst']) : $board_config['board_dst'];
...should be...

Code: Select all

$user_dst=( isset($HTTP_POST_VARS['dst']) ) ? intval($HTTP_POST_VARS['dst']) : 0;
...because you have not added the 'board_dst' field to the config DB table.

I have also adapted your code and added it to 'admin/admin_users.php' for completeness :-)
Regards, Remix_88.
mtcrowe
Registered User
Posts: 3
Joined: Wed Nov 16, 2005 2:15 am

Post by mtcrowe »

oops, you're right on that part. I had the board_config part in there because I was trying to get the code to work with the server so guests would see DST as well. Forgot to take that part out.

Michael
"Without hope (we) would drown in our sorrow" -Lady Yunalesca FFX

Crow's Nest Online Support Group
Damic
Registered User
Posts: 11
Joined: Mon Mar 17, 2003 6:25 pm
Location: Belgium
Contact:

Post by Damic »

WEIRD

I've run my mod on 2 forums and they work all fine :|
User avatar
markismx
Registered User
Posts: 39
Joined: Mon May 15, 2006 9:22 am

Post by markismx »

I can not make this mod work on my forum. First I've installed with Easy Mod, and it did not worked, then I tryed patching like mtcrowe suggested, but didn't work also.

Apperantly it works fine, I have no error messages, but it simply does not do what it's suppose to.

How can I make it work????
Damic
Registered User
Posts: 11
Joined: Mon Mar 17, 2003 6:25 pm
Location: Belgium
Contact:

Post by Damic »

mmmh weird its getting weirder everytime :?

Whet he doesn't do, count +1h if your in a DST time zone beacouse
Apperantly it works fine, I have no error messages, but it simply does not do what it's suppose to.
I can't do anything with that :|
gAnDo
Registered User
Posts: 20
Joined: Sun Sep 04, 2005 4:56 pm

Re: [BETA] ADD DST in phpBB

Post by gAnDo »

The original code didnt work for me either (no errors just didnt change the time) but the code posted by mtcrowe done it perfectly so thankyou both :)
User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3510
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Re: [BETA] ADD DST in phpBB

Post by bonelifer »

Here's mtcrowe code modified to be correct to phpBB MOD Actions template and it now installs via Easymod(at least it did for me).

Code: Select all

############################################################## 
## MOD Title: Add DST (Daylight Saving Time)
## MOD Author: Damic
## MOD Description: This mod will add the DST feature to your forum.
## MOD Version:  BETA 0.0.0
## MOD Download: http://home.scarlet.be/~guido456/andere/add_DST.txt
## 
## Installation Level: easy/medium
## Installation Time: 10 Minutes 
## Files To Edit: (4) 
##	usercp_register.php
##	lang_main.php
##	profile_add_body.tpl
##	functions.php
##
## Included Files: (0)
## 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. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/
############################################################## 
## MOD History:
##  BETA  0.0.3: Admin Config Board  (ACP) Changed + Mod History
##  BETA  0.0.2: Saves user DST info now + corrects the hours + Some syntax changed
##  ALPHA 0.0.1: First release, nothing to fancy
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################

#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE `phpbb_users` ADD `user_dst` TINYINT( 1 ) NOT NULL DEFAULT '0';

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#289
   $user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_timezone'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
   $user_dst=( isset($HTTP_POST_VARS['dst']) ) ? intval($HTTP_POST_VARS['dst']) : $board_config['board_dst'];


#
#-----[ FIND ]------------------------------------------
#746
			$sql = "UPDATE " . USERS_TABLE . "
				SET

#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_timezone = $user_timezone,   

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
# must look like this:  $user_timezone, user_dst=$user_dst,
#
user_dst = $user_dst, 

#
#-----[ FIND ]------------------------------------------
#1186
   $user_dateformat = $userdata['user_dateformat'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
   $user_dst = $userdata['user_dst'];

#
#-----[ FIND ]------------------------------------------
#1522
   'SMILIES_STATUS' => $smilies_status,

#
#-----[ AFTER, ADD ]------------------------------------------
#
'DST_SELECT_NO'=>(!$user_dst)? 'checked="checked"' : '',
'DST_SELECT_YES'=>($user_dst)? 'checked="checked"' : '',

#
#-----[ FIND ]------------------------------------------
#1619
   'L_EMAIL_ADDRESS' => $lang['Email_address'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

'L_DST'=> $lang['DST'],

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl

#
#-----[ FIND ]------------------------------------------
#
   <tr>
 <td class="row1"><span class="gen">{L_TIMEZONE}:</span></td>
 <td class="row2"><span class="gensmall">{TIMEZONE_SELECT}</span></td>
   </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

   <tr>
 <td class="row1"><span class="gen">{L_DST}:</span></td>
 <td class="row2">
  <input type="radio" name="dst" value="1" {DST_SELECT_YES} />
  <span class="gen">{L_YES}</span>&nbsp;&nbsp;
  <input type="radio" name="dst" value="0" {DST_SELECT_NO} />
  <span class="gen">{L_NO}</span>
 </td>
   </tr>

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
   $lang['Timezone'] = 'Timezone';

#
#-----[ AFTER, ADD ]------------------------------------------
#
   $lang['DST']='Daylight Saving Time';

#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------
#
   global $board_config, $lang;

#
#-----[ IN-LINE FIND ]------------------------------------------
#
;

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
# it must look like this: global $board_config, $lang, $userdata;
#
   , $userdata


#
#-----[ FIND ]------------------------------------------
#
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));

#
#-----[ REPLACE WITH ]------------------------------------------
#
if(!$userdata['user_dst']==0)
{
   return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz) + (date('I') * 3600)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz) + (date('I') * 3600));
}
else
   {
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));
}

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
# EoM
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
Please don't contact me via PM or email for phpBB support .
pokerxanadu
Registered User
Posts: 23
Joined: Tue Jan 31, 2006 12:45 am

Re: [BETA] ADD DST in phpBB

Post by pokerxanadu »

Does anyone know how I can change the code in this mod (the corrected version) so that DST is selected by default when a new user registers?
Post Reply

Return to “[2.0.x] MODs in Development”