why does it come up with 31 Dec 1969 19:00:00 for each user?
Sounds like the bridge isn't filling dateRegistered = time().
-[Unknown]
Is this something on my part or something missed in the bridge?
Hmmm.... I don't know what you could have done to cause this... but my copy of the bridge records the correct date registered... (?)
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.
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 :)
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?
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');
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
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?
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.
<?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.
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]
Hi,
The table in Mambo is mos_user -
registerDate.In SMF the table is smf_members -
dateRegisteredI 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
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]
not sure what happen, but using the script above, i now see about 5 of the same users. will it cause problems?
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]
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
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? (http://www.simplemachines.org/community/index.php?topic=21919.0)
-[Unknown]
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? (http://www.simplemachines.org/community/index.php?topic=21919.0)
-[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
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]
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
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.
UPDATE smf_members
SET dateRegistered = UNIX_TIMESTAMP('2004-01-01')
WHERE dateRegistered = 0;
-[Unknown]
Rock on. Thanks.