News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

date registered incorrect

Started by profile, February 23, 2005, 06:47:18 PM

Previous topic - Next topic

profile

why does it come up with 31 Dec 1969 19:00:00 for each user?

[Unknown]

Sounds like the bridge isn't filling dateRegistered = time().

-[Unknown]

profile

Is this something on my part or something missed in the bridge?

Kindred

Hmmm.... I don't know what you could have done to cause this... but my copy of the bridge records the correct date registered... (?)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

profile

If I test using the register button on the login form, it works fine.  If I click on the 'register to read more' from mambo (yes, i know it doesn't use the bridge), and then use the mos2smfusers.php to migrate the user, the date is incorrect.

chadness

That's because it's not transferring the registration date over.  The date you're seeing is the equivilent to "zero" in dates in computer terms.  I'd say change that link to the correct one in the bridge, and you don't need to worry about it :)

profile

Quote from: chadness on February 24, 2005, 10:07:32 PM
That's because it's not transferring the registration date over.  The date you're seeing is the equivilent to "zero" in dates in computer terms.  I'd say change that link to the correct one in the bridge, and you don't need to worry about it :)

We learn new things everyday.  Didn't know it's equivalent to "zero".  Thanks for the tip, but how can I change the "register to read more" link that is automatically placed by Mambo?

chadness

Looks like line 270 of content.html.php in my install - should be somewhere around there.  This is the line:
$link = sefRelToAbs( 'index.php?option=com_registration&task=register' );
should probably read:
$link = sefRelToAbs( 'index.php?&option=com_smf_registration&task=register');

profile

thanks for your assistance.

Since there are three instance, I tried them all and still no luck.  The one I modified is located in /components/com_content/content.html.php

mikewest

i actually got this too, when i transferred all my users over using the mos2smfusers.php they all had that registration date...... anyone fix this yet?


profile

Quote from: mikewest on February 25, 2005, 04:30:00 PM
i actually got this too, when i transferred all my users over using the mos2smfusers.php they all had that registration date...... anyone fix this yet?



I'm glad I'm not the only one.  No solution yet.

profile

<?php

// edit this line to reflect the path to SSI.php
require ("path/to/SSI.php");

// edit these variables for your table prefixes.  They are set at the defaults, so you probably won't need to.
$mos_prefix "mos_";
$smf_prefix "smf_";

//get usernames already existing in Mambo, one by one

$mos_sql "SELECT username, email, password FROM {$mos_prefix}users";

$mos_result mysql_query($mos_sql);

while (
$mos_row mysql_fetch_array($mos_result,MYSQL_NUM)) {
$mos_user $mos_row[0];
// try to find a match in the SMF users
    
$smf_sql "SELECT memberName FROM {$smf_prefix}members WHERE (memberName ='".$mos_user."')";
    
$smf_result mysql_query ($smf_sql);

    
$smf_row mysql_fetch_array($smf_result);

// if the username already exists in both, don't do anything
if ($smf_row[0]!='')
  echo $smf_row[0]." already exists<br />";
else {
// if the username doesn't exist in SMF, create it
  $write_user "INSERT INTO {$smf_prefix}members (memberName, realName, passwd, emailAddress) VALUES ('$mos_row[0]','$mos_row[0]','$mos_row[2]','$mos_row[1]')";
  $write_result mysql_query ($write_user);
  echo $mos_row[0]." added to SMF <br />";
  
}

    
mysql_free_result($smf_result);
}

mysql_free_result($mos_result);









?>


I don't know php or any of this, so hoping someone will be able to determine where the date is pulled from or correct the script.

[Unknown]

Does Mambo track the registration date?  If so, what column?  If not:

<?php

// Edit this line to reflect the path to SSI.php.
require_once('/path/to/SSI.php');

// Edit these variables for your table prefixes. They are set at the defaults, so you probably won't need to.
$mos_prefix 'mos_';
$smf_prefix '`' $db_name '`.' $db_prefix;

// Get usernames already existing in Mambo, one by one...
$mos_result mysql_query("
SELECT username, email, password
FROM 
{$mos_prefix}users") or die(mysql_error());
while (
$mos_row mysql_fetch_row($mos_result))
{
$mos_user $mos_row[0];
// Try to find a match in the SMF members.
$smf_result mysql_query("
SELECT memberName
FROM 
{$smf_prefix}members
WHERE memberName ='
$mos_row[0]'
LIMIT 1"
) or die(mysql_error());
$smf_row mysql_fetch_array($smf_result);
mysql_free_result($smf_result);

// If the username already exists in both, don't do anything.
if (!empty($smf_row[0]))
echo '
'
$smf_row[0], ' already exists.<br />';
else
{
// If the username doesn't exist in SMF, create it!
$write_result mysql_query("
INSERT INTO 
{$smf_prefix}members
(memberName, realName, passwd, emailAddress, dateRegistered)
VALUES ('
$mos_row[0]', '$mos_row[0]', '$mos_row[2]', '$mos_row[1]', " time() . ")") or die(mysql_error());
echo '
'
$mos_row[0], ' added to SMF.<br />';
 
}
}
mysql_free_result($mos_result);

?>


-[Unknown]

deejayh

Hi,

The table in Mambo is mos_user - registerDate.
In SMF  the table is smf_members - dateRegistered

I am not good at php, but I cannot see the selection of the registerDate from the above code:
Quote$mos_result = mysql_query("
   SELECT username, email, password
   FROM {$mos_prefix}users")
YET further down it says:
QuoteINSERT INTO {$smf_prefix}members
            (memberName, realName, passwd, emailAddress, dateRegistered)
Maybe some one can clarify?
Cheers,
Dave

Regards,
Dave
Family History UK  - http://www.familyhistory.uk.com

[Unknown]

In that case, try this:

<?php

// Edit this line to reflect the path to SSI.php.
require_once('/path/to/SSI.php');

// Edit these variables for your table prefixes. They are set at the defaults, so you probably won't need to.
$mos_prefix 'mos_';
$smf_prefix '`' $db_name '`.' $db_prefix;

// Get usernames already existing in Mambo, one by one...
$mos_result mysql_query("
SELECT username, email, password, UNIX_TIMESTAMP(registerDate) AS registerDate
FROM 
{$mos_prefix}users") or die(mysql_error());
while (
$mos_row mysql_fetch_assoc($mos_result))
{
// Try to find a match in the SMF members.
$smf_result mysql_query("
SELECT memberName
FROM 
{$smf_prefix}members
WHERE memberName = '
$mos_row[username]'
LIMIT 1"
) or die(mysql_error());
$smf_row mysql_fetch_array($smf_result);
mysql_free_result($smf_result);

// If the username already exists in both, don't do anything.
if (!empty($smf_row['username']))
echo '
'
$smf_row['username'], ' already exists.<br />';
else
{
// If the username doesn't exist in SMF, create it!
$write_result mysql_query("
INSERT INTO 
{$smf_prefix}members
(memberName, realName, passwd, emailAddress, dateRegistered)
VALUES ('
$mos_row[username]', '$mos_row[username]', '$mos_row[password]', '$mos_row[email]', '$mod_row[registerDate]')") or die(mysql_error());
echo '
'
$mos_row['username'], ' added to SMF.<br />';
}
}
mysql_free_result($mos_result);

?>


-[Unknown]

profile

not sure what happen, but using the script above, i now see about 5 of the same users.  will it cause problems?

[Unknown]

#16
Hmm.. there's a typo.  Here:

<?php

// Edit this line to reflect the path to SSI.php.
require_once('/path/to/SSI.php');

// Edit these variables for your table prefixes. They are set at the defaults, so you probably won't need to.
$mos_prefix 'mos_';
$smf_prefix '`' $db_name '`.' $db_prefix;

// Get usernames already existing in Mambo, one by one...
$mos_result mysql_query("
SELECT username, email, password, UNIX_TIMESTAMP(registerDate) AS registerDate
FROM 
{$mos_prefix}users") or die(mysql_error());
while (
$mos_row mysql_fetch_assoc($mos_result))
{
// Try to find a match in the SMF members.
$smf_result mysql_query("
SELECT memberName
FROM 
{$smf_prefix}members
WHERE memberName = '
$mos_row[username]'
LIMIT 1"
) or die(mysql_error());
$smf_row mysql_fetch_array($smf_result);
mysql_free_result($smf_result);

// If the username already exists in both, don't do anything.
if (!empty($smf_row['memberName']))
echo '
'
$smf_row['username'], ' already exists.<br />';
else
{
// If the username doesn't exist in SMF, create it!
$write_result mysql_query("
INSERT INTO 
{$smf_prefix}members
(memberName, realName, passwd, emailAddress, dateRegistered)
VALUES ('
$mos_row[username]', '$mos_row[username]', '$mos_row[password]', '$mos_row[email]', '$mos_row[registerDate]')") or die(mysql_error());
echo '
'
$mos_row['username'], ' added to SMF.<br />';
}
}
mysql_free_result($mos_result);

?>


-[Unknown]

profile

Thanks for the updated code.  It seems to detect existing users now, but for the test accounts that were already migrated, is there a way to transfer the UNIX date over?  If not, will deleting the user from SMF make all post counts/messages disappear?  TIA

[Unknown]

If using MySQL 4:

CREATE TEMPORARY TABLE switchover
SELECT mos.username, UNIX_TIMESTAMP(mos.registerDate) AS registerDate
FROM mambo.mos_users AS mos, smf.smf_members AS smf
WHERE smf.memberName = mos.username
   AND IFNULL(smf.dateRegistered, 0) = 0;

UPDATE smf.smf_members, mambo.mos_users
SET smf.smf_members.dateRegistered = UNIX_TIMESTAMP(mambo.mos_users.registerDate)
WHERE smf.smf_members.memberName = mambo.mos_users.username;

DROP TABLE switchover;

What is phpMyAdmin?

-[Unknown]

profile

Quote from: [Unknown] on March 15, 2005, 11:46:29 PM
If using MySQL 4:

CREATE TEMPORARY TABLE switchover
SELECT mos.username, UNIX_TIMESTAMP(mos.registerDate) AS registerDate
FROM mambo.mos_users AS mos, smf.smf_members AS smf
WHERE smf.memberName = mos.username
   AND IFNULL(smf.dateRegistered, 0) = 0;

UPDATE smf.smf_members, mambo.mos_users
SET smf.smf_members.dateRegistered = UNIX_TIMESTAMP(mambo.mos_users.registerDate)
WHERE smf.smf_members.memberName = mambo.mos_users.username;

DROP TABLE switchover;

What is phpMyAdmin?

-[Unknown]


Correct me if I'm wrong.  Anyone that have a different mambo prefix, they should change everywhere you have mos_ to {prefix}_

ie: if an user is using test as their mambo prefix
SELECT mos.username,
will then be SELECT test.username,

FROM mambo.mos_users
will then be FROM mambo.test_users

etc. etc.

I use find > replace


[Unknown]

Quote from: profile on March 16, 2005, 11:34:53 AM
Correct me if I'm wrong.  Anyone that have a different mambo prefix, they should change everywhere you have mos_ to {prefix}_

ie: if an user is using test as their mambo prefix
SELECT mos.username,
will then be SELECT test.username,

FROM mambo.mos_users
will then be FROM mambo.test_users

No, they should change "smf.smf_" to their database name dot table prefix, and mambo.mos_ to their database name, dot, and table prefix for Mambo.  You should not change the "mos." at all.

-[Unknown]

Fardo

Thnx It worked!!!!

you should indeed change "smf.smf_" to their database name dot table prefix, and mambo.mos_ to their database name, dot, and table prefix for Mambo

NoRad

Here is a valid date: 1088918391
A lot of my invalid dates from the Snitz migration were: 0

I need a default date for the old Snitz users with 0. I am thinking about setting them all to January 1st, 2002. What would be my mySQL string to do this? Thanks.

[Unknown]

UPDATE smf_members
SET dateRegistered = UNIX_TIMESTAMP('2004-01-01')
WHERE dateRegistered = 0;

-[Unknown]

NoRad


Advertisement: