Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Admin (Coder) Admin is offline
Developer Last Online: Nov 2024 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 09-15-2001 Last Update: Never Installs: 23
 
No support by the author.

This hack adds an option for the user to select the date format and time format he wants to use in the forum.
Good for people from different countries, that use different formats.
Requested by markrt.

Demo:


Run this query:
Code:
ALTER TABLE user ADD dateformat VARCHAR(4) DEFAULT '-1' not null AFTER timezoneoffset, ADD timeformat VARCHAR(4) DEFAULT '-1' not null AFTER dateformat;
(for more information on running queries visit the Troubleshooting and Problems forum)

In your modifyoptions template add this code:
Code:
<tr>
	<td bgcolor="{secondaltcolor}"><normalfont><b>Date format</b></normalfont><br>
	<smallfont>Select what format you would like to use for dates.</smallfont></td>
	<td bgcolor="{secondaltcolor}"><smallfont>
	<select name="newdateformat">
		<option value="-1" $datedefselected>Use forum default</option>
		<option value="0" $date0selected>04-25-1998</option>
		<option value="1" $date1selected>04-25-98</option>
		<option value="2" $date2selected>04.25.1998</option>
		<option value="3" $date3selected>04.25.98</option>
		<option value="4" $date4selected>25-04-1998</option>
		<option value="5" $date5selected>25-04-98</option>
		<option value="6" $date6selected>25.04.1998</option>
		<option value="7" $date7selected>25.04.98</option>
		<option value="8" $date8selected>April 25th, 1998</option>
		<option value="9" $date9selected>Saturday, April 25th, 1998</option>
		<option value="10" $date10selected>25th April 1998</option>
		<option value="11" $date11selected>Saturday, 25th April 1998</option>
	</select></smallfont></td>
</tr>
<tr>
	<td bgcolor="{firstaltcolor}"><normalfont><b>Time format</b></normalfont><br>
	<smallfont>Select what format you would like to use for times.</smallfont></td>
	<td bgcolor="{firstaltcolor}"><smallfont>
	<select name="newtimeformat">
		<option value="-1" $timedefselected>Use forum default</option>
		<option value="0" $time0selected>08:15 pm</option>
		<option value="1" $time1selected>08:15:48 pm</option>
		<option value="2" $time2selected>08:15 PM</option>
		<option value="3" $time3selected>08:15:48 PM</option>
		<option value="4" $time4selected>20:15</option>
		<option value="5" $time5selected>20:15:48</option>
	</select></smallfont></td>
</tr>
right after
Code:
		<option value="+12" $timezonesel[120]>(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall Island</option>
	</select></smallfont></td>
</tr>
In member.php add this code:
PHP Code:
  if ($bbuserinfo[dateformat]!=-1) {
    
$dateformat="date".$bbuserinfo[dateformat]."selected";
    $
$dateformat "selected";
  } else {
    
$datedefselected "selected";
  }

  if (
$bbuserinfo[timeformat]!=-1) {
    
$timeformatsel="time".$bbuserinfo[timeformat]."selected";
    $
$timeformatsel "selected";
  } else {
    
$timedefselected "selected";
  } 
right after
PHP Code:
  if ($bbuserinfo[timezoneoffset]<0) {
    
$timezonesel["n".(-$bbuserinfo[timezoneoffset]*10)]="selected";
  } else {
    
$timezonesel[$bbuserinfo[timezoneoffset]*10]="selected";
  } 
Still in member.php, replace this code:
Code:
  $DB_site->query("UPDATE user
                   SET ".$updatestyles."adminemail='$adminemail',
                      showemail='$showemail',invisible='$invisible',cookieuser='$cookieuser',
                      maxposts='".addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
                      timezoneoffset='".addslashes($timezoneoffset)."',emailnotification='$emailnotification',
                      startofweek='".addslashes($startofweek)."',options='$options',receivepm='$receivepm',
                      emailonpm='$emailonpm',pmpopup='$pmpopup',usergroupid='$bbuserinfo[usergroupid]',
                      nosessionhash='$nosessionhash'
                   WHERE userid='$bbuserinfo[userid]'");
with this code:
Code:
  $DB_site->query("UPDATE user
                   SET ".$updatestyles."adminemail='$adminemail',
                      showemail='$showemail',invisible='$invisible',cookieuser='$cookieuser',
                      maxposts='".addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
                      dateformat='".addslashes($newdateformat)."',timeformat='".addslashes($newtimeformat)."',
                      timezoneoffset='".addslashes($timezoneoffset)."',emailnotification='$emailnotification',
                      startofweek='".addslashes($startofweek)."',options='$options',receivepm='$receivepm',
                      emailonpm='$emailonpm',pmpopup='$pmpopup',usergroupid='$bbuserinfo[usergroupid]',
                      nosessionhash='$nosessionhash'
                   WHERE userid='$bbuserinfo[userid]'");
(note: this code might be changed in your file due to another hack. If so, just add the code that is in red)

In global.php (main directory) add this code:
PHP Code:
// change to right date format
if ($bbuserinfo[dateformat]!="-1") {
  if (
$bbuserinfo[dateformat]=="0") {
    
$dateformat "m-d-Y";
  } elseif (
$bbuserinfo[dateformat]=="1") {
    
$dateformat "m-d-y";
  } elseif (
$bbuserinfo[dateformat]=="2") {
    
$dateformat "m.d.Y";
  } elseif (
$bbuserinfo[dateformat]=="3") {
    
$dateformat "m.d.y";
  } elseif (
$bbuserinfo[dateformat]=="4") {
    
$dateformat "d-m-Y";
  } elseif (
$bbuserinfo[dateformat]=="5") {
    
$dateformat "d.m.y";
  } elseif (
$bbuserinfo[dateformat]=="6") {
    
$dateformat "d.m.y";
  } elseif (
$bbuserinfo[dateformat]=="7") {
    
$dateformat "d.m.y";
  } elseif (
$bbuserinfo[dateformat]=="8") {
    
$dateformat "F jS, Y";
  } elseif (
$bbuserinfo[dateformat]=="9") {
    
$dateformat "l, F jS, Y";
  } elseif (
$bbuserinfo[dateformat]=="10") {
    
$dateformat "jS F Y";
  } elseif (
$bbuserinfo[dateformat]=="11") {
    
$dateformat "l, jS F Y";
  } else {
    
$dateformat "$dateformat";
  }
}

// change to right time format
if ($bbuserinfo[timeformat]!="-1") {
  if (
$bbuserinfo[timeformat]=="0") {
    
$timeformat "h:i a";
  } elseif (
$bbuserinfo[timeformat]=="1") {
    
$timeformat "h:i:s a";
  } elseif (
$bbuserinfo[timeformat]=="2") {
    
$timeformat "h:i A";
  } elseif (
$bbuserinfo[timeformat]=="3") {
    
$timeformat "h:i:s A";
  } elseif (
$bbuserinfo[timeformat]=="4") {
    
$timeformat "H:i";
  } elseif (
$bbuserinfo[timeformat]=="5") {
    
$timeformat "H:i:s";
  } else {
    
$timeformat "$timeformat";
  }

right after
PHP Code:
// ###################### Referrer Stuff ######################### 
That's it.
I know it might look long, but it's really very very easy to install.
If you have any troubles with that block I told you about, ask for help here.

Feedback please!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 09-17-2001, 12:22 AM
[VbbFr]Elie
Guest
 
Posts: n/a
Default

I just want to add a quite touch to make the script better

Use this code to show the moment date and time


In your modifyoptions template add this code:

PHP Code:
<tr>
    <
td bgcolor="#DFDFDF"><normalfont><b>Date format</b></normalfont><br>
    <
smallfont>Select what format you would like to use for dates.</smallfont></td>
    <
td bgcolor="#DFDFDF"><smallfont>
    <
select name="newdateformat">
        <
option value="-1" $datedefselected>Use forum default</option>
        <
option value="0" $date0selected>$date1</option>        <option value="1" $date1selected>$date2</option>
        <
option value="2" $date2selected>$date3</option>
        <
option value="3" $date3selected>$date4</option>
        <
option value="4" $date4selected>$date5</option>
        <
option value="5" $date5selected>$date6</option>
        <
option value="6" $date6selected>$date7</option>
        <
option value="7" $date7selected>$date8</option>
        <
option value="8" $date8selected>$date9</option>
        <
option value="9" $date9selected>$date10</option>
        <
option value="10" $date10selected>$date11</option>
        <
option value="11" $date11selected>$date12</option>
    </
select></smallfont></td>
</
tr>
<
tr>
    <
td bgcolor="#F1F1F1"><normalfont><b>Time format</b></normalfont><br>
    <
smallfont>Select what format you would like to use for times.</smallfont></td>
    <
td bgcolor="#F1F1F1"><smallfont>
    <
select name="newtimeformat">
        <
option value="-1" $timedefselected>Use forum default</option>
        <
option value="0" $time0selected>$time1</option>
        <
option value="1" $time1selected>$time2</option>
        <
option value="2" $time2selected>$time3</option>
        <
option value="3" $time3selected>$time4</option>
        <
option value="4" $time4selected>$time5</option>
        <
option value="5" $time5selected>$time6</option>
    </
select></smallfont></td>
</
tr
In global.php (main directory) add this code:

PHP Code:
 // change to right date format 


$date1=Date('m-d-Y');
$date2=Date('m-d-y');
$date3=Date('m.d.Y');
$date4=Date('m.d.y');
$date5=Date('d-m-Y');
$date6=Date('d-m-y');
$date7=Date('d.m.Y');
$date8=Date('d.m.y');
$date9=Date('F jS, Y');
$date10=Date('l, F jS, Y');
$date11=Date('jS F Y');
$date12=Date('l, jS F Y');

$time1=Date('h:i a');
$time2=Date('h:i:s a');
$time3=Date('h:i A');
$time4=Date('h:i:s A');
$time5=Date('H:i');
$time6=Date('H:i:s');


if (
$bbuserinfo[dateformat]!="-1") { 
if (
$bbuserinfo[dateformat]=="0") { 
$dateformat "m-d-Y"
} elseif (
$bbuserinfo[dateformat]=="1") { 
$dateformat "m-d-y"
} elseif (
$bbuserinfo[dateformat]=="2") { 
$dateformat "m.d.Y"
} elseif (
$bbuserinfo[dateformat]=="3") { 
$dateformat "m.d.y"
} elseif (
$bbuserinfo[dateformat]=="4") { 
$dateformat "d-m-Y"
} elseif (
$bbuserinfo[dateformat]=="5") { 
$dateformat "d-m-y"
} elseif (
$bbuserinfo[dateformat]=="6") { 
$dateformat "d.m.Y"
} elseif (
$bbuserinfo[dateformat]=="7") { 
$dateformat "d.m.y"
} elseif (
$bbuserinfo[dateformat]=="8") { 
$dateformat "F jS, Y"
} elseif (
$bbuserinfo[dateformat]=="9") { 
$dateformat "l, F jS, Y"
} elseif (
$bbuserinfo[dateformat]=="10") { 
$dateformat "jS F Y"
} elseif (
$bbuserinfo[dateformat]=="11") { 
$dateformat "l, jS F Y"
} else { 
$dateformat "$dateformat"



// change to right time format 
if ($bbuserinfo[timeformat]!="-1") { 
if (
$bbuserinfo[timeformat]=="0") { 
$timeformat "h:i a"
} elseif (
$bbuserinfo[timeformat]=="1") { 
$timeformat "h:i:s a"
} elseif (
$bbuserinfo[timeformat]=="2") { 
$timeformat "h:i A"
} elseif (
$bbuserinfo[timeformat]=="3") { 
$timeformat "h:i:s A"
} elseif (
$bbuserinfo[timeformat]=="4") { 
$timeformat "H:i"
} elseif (
$bbuserinfo[timeformat]=="5") { 
$timeformat "H:i:s"
} else { 
$timeformat "$timeformat"


  • I add the french version too
Reply With Quote
  #13  
Old 09-17-2001, 06:12 PM
DarkReaper DarkReaper is offline
 
Join Date: Oct 2001
Posts: 429
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey firefly...think you could get in the habit of putting your hacks in text files? Thanks!

Worked great.
Reply With Quote
  #14  
Old 09-17-2001, 09:19 PM
Soul Lord XL
Guest
 
Posts: n/a
Default

Quote:
Originally posted by [VbbFr]Elie
I just want to add a quite touch to make the script better

Use this code to show the moment date and time


In your modifyoptions template add this code:

PHP Code:
<tr>
    <
td bgcolor="#DFDFDF"><normalfont><b>Date format</b></normalfont><br>
    <
smallfont>Select what format you would like to use for dates.</smallfont></td>
    <
td bgcolor="#DFDFDF"><smallfont>
    <
select name="newdateformat">
        <
option value="-1" $datedefselected>Use forum default</option>
        <
option value="0" $date0selected>$date1</option>        <option value="1" $date1selected>$date2</option>
        <
option value="2" $date2selected>$date3</option>
        <
option value="3" $date3selected>$date4</option>
        <
option value="4" $date4selected>$date5</option>
        <
option value="5" $date5selected>$date6</option>
        <
option value="6" $date6selected>$date7</option>
        <
option value="7" $date7selected>$date8</option>
        <
option value="8" $date8selected>$date9</option>
        <
option value="9" $date9selected>$date10</option>
        <
option value="10" $date10selected>$date11</option>
        <
option value="11" $date11selected>$date12</option>
    </
select></smallfont></td>
</
tr>
<
tr>
    <
td bgcolor="#F1F1F1"><normalfont><b>Time format</b></normalfont><br>
    <
smallfont>Select what format you would like to use for times.</smallfont></td>
    <
td bgcolor="#F1F1F1"><smallfont>
    <
select name="newtimeformat">
        <
option value="-1" $timedefselected>Use forum default</option>
        <
option value="0" $time0selected>$time1</option>
        <
option value="1" $time1selected>$time2</option>
        <
option value="2" $time2selected>$time3</option>
        <
option value="3" $time3selected>$time4</option>
        <
option value="4" $time4selected>$time5</option>
        <
option value="5" $time5selected>$time6</option>
    </
select></smallfont></td>
</
tr
In global.php (main directory) add this code:

PHP Code:
 // change to right date format 


$date1=Date('m-d-Y');
$date2=Date('m-d-y');
$date3=Date('m.d.Y');
$date4=Date('m.d.y');
$date5=Date('d-m-Y');
$date6=Date('d-m-y');
$date7=Date('d.m.Y');
$date8=Date('d.m.y');
$date9=Date('F jS, Y');
$date10=Date('l, F jS, Y');
$date11=Date('jS F Y');
$date12=Date('l, jS F Y');

$time1=Date('h:i a');
$time2=Date('h:i:s a');
$time3=Date('h:i A');
$time4=Date('h:i:s A');
$time5=Date('H:i');
$time6=Date('H:i:s');


if (
$bbuserinfo[dateformat]!="-1") { 
if (
$bbuserinfo[dateformat]=="0") { 
$dateformat "m-d-Y"
} elseif (
$bbuserinfo[dateformat]=="1") { 
$dateformat "m-d-y"
} elseif (
$bbuserinfo[dateformat]=="2") { 
$dateformat "m.d.Y"
} elseif (
$bbuserinfo[dateformat]=="3") { 
$dateformat "m.d.y"
} elseif (
$bbuserinfo[dateformat]=="4") { 
$dateformat "d-m-Y"
} elseif (
$bbuserinfo[dateformat]=="5") { 
$dateformat "d-m-y"
} elseif (
$bbuserinfo[dateformat]=="6") { 
$dateformat "d.m.Y"
} elseif (
$bbuserinfo[dateformat]=="7") { 
$dateformat "d.m.y"
} elseif (
$bbuserinfo[dateformat]=="8") { 
$dateformat "F jS, Y"
} elseif (
$bbuserinfo[dateformat]=="9") { 
$dateformat "l, F jS, Y"
} elseif (
$bbuserinfo[dateformat]=="10") { 
$dateformat "jS F Y"
} elseif (
$bbuserinfo[dateformat]=="11") { 
$dateformat "l, jS F Y"
} else { 
$dateformat "$dateformat"



// change to right time format 
if ($bbuserinfo[timeformat]!="-1") { 
if (
$bbuserinfo[timeformat]=="0") { 
$timeformat "h:i a"
} elseif (
$bbuserinfo[timeformat]=="1") { 
$timeformat "h:i:s a"
} elseif (
$bbuserinfo[timeformat]=="2") { 
$timeformat "h:i A"
} elseif (
$bbuserinfo[timeformat]=="3") { 
$timeformat "h:i:s A"
} elseif (
$bbuserinfo[timeformat]=="4") { 
$timeformat "H:i"
} elseif (
$bbuserinfo[timeformat]=="5") { 
$timeformat "H:i:s"
} else { 
$timeformat "$timeformat"


  • I add the french version too
U could tell us whereto put it
Reply With Quote
  #15  
Old 09-17-2001, 09:20 PM
Soul Lord XL
Guest
 
Posts: n/a
Default

I fixed the error, now it is working, but there is 1 problem...

When i click Submit options, it says:

There seems to have been a slight problem with the database. Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.

what is that happening it?
Reply With Quote
  #16  
Old 09-18-2001, 06:34 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What's the error you are gettings?
Did you run the query?
Reply With Quote
  #17  
Old 09-18-2001, 02:20 PM
Soul Lord XL
Guest
 
Posts: n/a
Default

The EMAIL says:

Quote:
Database error in vBulletin: Invalid SQL: UPDATE user
SET styleid='1',adminemail='1',
showemail='1',invisible='0',cookieuser='1',
maxposts='-1',daysprune='-1',
dateformat='9',timeformat='-1',
startofweek='2',options='15',receivepm='1',
emailonpm='0',pmpopup='1',usergroupid='6',
nosessionhash='0'
WHERE userid='1'
mysql error: Unknown column 'dateformat' in 'field list'
mysql error number: 1054
Date: Tuesday 18th of September 2001 01:00:28 AM
Script:
/vbb/member.php?invisible=no&cookieuser=yes&nosessionha sh=no&allowmail=yes&showemail=yes&emailnotificatio n=no&receivepm=yes&emailonpm=no&pmpopup=yes&showsi gnatures=yes&showavatars=yes&showimages=yes&pruned ays=-1&umaxposts=-1&startofweek=2&timezoneoffset=-5&newdateformat=9&newtimeformat=-1&vbcode=yes&newstyleset=1&action=updateoptions&Su bmit=Submit+Modifications
Referer:
http://www.shenlong20xl.com/vbb/memb...on=editoptions

I cant find that code anywhere
Reply With Quote
  #18  
Old 09-18-2001, 02:36 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looks like you didn't run the query like I said:
Code:
ALTER TABLE user ADD dateformat VARCHAR(4) DEFAULT '-1' not null AFTER timezoneoffset, ADD timeformat VARCHAR(4) DEFAULT '-1' not null AFTER dateformat;
Run it using phpMyAdmin or Telnet.
Reply With Quote
  #19  
Old 09-18-2001, 03:01 PM
markrt
Guest
 
Posts: n/a
Default

Hi FireFly

This is to say Thank You for doing this hack.

It works well and has made many of my users very happy.

This would be a very good hack to have included in the next version of VB

Thanks Again.
Mark Thornton
Reply With Quote
  #20  
Old 09-18-2001, 05:11 PM
Soul Lord XL
Guest
 
Posts: n/a
Default

Im not a super expert at hacks or anything firefly.

so can u tell me like what to do more specific (EX: go to folder and then to whatever.php and insert code after bla)

thanx
Reply With Quote
  #21  
Old 09-24-2001, 08:34 PM
ubje ubje is offline
 
Join Date: Nov 2001
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by FireFly

Code:
ALTER TABLE user ADD dateformat VARCHAR(4) DEFAULT '-1' not null AFTER timezoneoffset, ADD timeformat VARCHAR(4) DEFAULT '-1' not null AFTER dateformat;
if you have run this query how can you undo it ????????
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:07 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04862 seconds
  • Memory Usage 2,452KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (7)bbcode_code
  • (8)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (5)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete