How to change a user join date

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
MCPB
Registered User
Posts: 198
Joined: Wed Jan 14, 2004 3:07 am

How to change a user join date

Post by MCPB »

I would like to change the join date of a user on my board. Is this possible??


Thanks!

StefanL
Registered User
Posts: 2265
Joined: Wed Jul 23, 2003 10:10 pm

Post by StefanL »

Yes. It's a UNIX time stamp. If you got phpMyAdmin go to this user and look for 'user_regdate' and then get the time stap go to http://www.4webhelp.net/us/timestamp.php
When I suggest that you should alter your files, BACKUP them BEFORE.

Wo1f
Registered User
Posts: 2039
Joined: Fri Jan 28, 2005 3:20 am

Post by Wo1f »

Hi MCPB,

This recent article contains a similar issue and also a link to an online human to Unix time converter, located here:
  • Last login time and date
[/url]

In your case though, you would have to modify the following field in the " Users " table --> " user_regdate ".

Hope this helps,
Wolf

MCPB
Registered User
Posts: 198
Joined: Wed Jan 14, 2004 3:07 am

Post by MCPB »

Thanks, this works too:


update_regdate.php

Code: Select all

<?php

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

// Change ?? to the user_id of the user you wish to update
$user_id = ??;

// change the following ?? to date you want to show as the joined date
$the_day = ??;
$the_month = ??;
$the_year = ????;

$the_hour = ??;
$the_minute = ??;
$the_second = ?;

// create the unix timestamp
$the_date = mktime($the_hour, $the_minute, $the_second, $the_month, $the_day, $the_year);

// update the users table
$sql = "UPDATE " . USERS_TABLE . " SET user_regdate = " . $the_date . " WHERE user_id = " . $user_id;
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not set user reg date.', '', __LINE__, __FILE__, $sql);
}

message_die(GENERAL_MESSAGE, 'Updated reg date for user: ' . $user_id . '<br /><br />Set date to: <b>' . $the_date . '</b> which is: ' . date("d M Y", $the_date));

?>
This stand alone code will get the unix time for you and update the DB.

Thanks guys for the input!

briano
Registered User
Posts: 25
Joined: Tue Nov 16, 2004 3:27 am

HELP

Post by briano »

ok everyone I just totally screwed up my reg_date field...

I have the joined date problem that shows unix time so I went into the nuke_users table and change the reg_date field to date instead of varchar..

now all my 2000 users have joined dates of 000000000..

WTF???

help, how do I restore that back to what it was? I have changed the field back, but they are still showing zeros!!

help help

thank you

Locked

Return to “2.0.x Support Forum”