I would like to see the return results for how many rows are in the table identities. Here is my snippet:
$num_id_row = $DB->query("select count(*) from ".get_table_name('identities'));
Is this correct? If so why do I only get the number 4..?
I need this because some thing has gone wrong with the new user code to where all new webmail users are nto incrementing and so they are nto displaying their proper identities. It seems to not be properly auto-incrementing the identity_id count.
Please any help would be appreciated.
Here is the rest of the code below with our changes in BOLD in the file main.inc.
-Sincerely,
DesertAdmin
// create new entry in users and identities table
function rcmail_create_user($user, $host)
{
global $DB, $CONFIG, $IMAP;
$user_email = '';
// try to resolve user in virtusertable
if (!empty($CONFIG['virtuser_file']) && strstr($user, '@')==FALSE)
$user_email = rcmail_user2email($user);
$DB->query("INSERT INTO ".get_table_name('users')."
(created, last_login, username, mail_host, alias, language)
VALUES (".$DB->now().", ".$DB->now().", ?, ?, ?, ?)",
$user,
$host,
$user_email,
$_SESSION['user_lang']);
if ($user_id = $DB->insert_id(get_sequence_name('users')))
{
$mail_domain = rcmail_mail_domain($host);
if ($user_email=='')
$user_email = strstr($user, '@') ? $user : sprintf('%s@%s', $user, $mail_domain);
$user_name = $user!=$user_email ? $user : '';
// try to resolve the e-mail address from the virtuser table
if (!empty($CONFIG['virtuser_query']) &&
($sql_result = $DB->query(preg_replace('/%u/', $user, $CONFIG['virtuser_query']))) &&
($DB->num_rows()>0))
while ($sql_arr = $DB->fetch_array($sql_result))
{
$DB->query("INSERT INTO ".get_table_name('identities')."
(user_id, del, standard, name, email)
VALUES (?, 0, 1, ?, ?)",
$user_id,
$user_name,
preg_replace('/^@/', $user . '@', $sql_arr[0]));
}
else
{
// also create new identity records
//omnicron and B-rad
// $num_id_row = mysql_query("select count(*) AS numrows from identities", DB);
// $num_id = mysql_fetch_array($num_id_row, MYSQL_ASSOC);
// $num_id_row = $DB->query("select count(*) AS numrows from ".get_table_name('identities'));
// $num_id = mysql_num_rows($num_id_rows);
$num_id_row = $DB->query("select count(*) from ".get_table_name('identities'));
//end omnicron and B-RAD
$DB->query("INSERT INTO ".get_table_name('identities')."
(identity_id, user_id, del, standard, name, email)
VALUES (?,?, 0, 1, ?, ?)",
//$num_id['numrows'],
$num_id_row,
$user_id,
$user_name,
$user_email);
}
// get existing mailboxes
$a_mailboxes = $IMAP->list_mailboxes();
}
else
{
raise_error(array('code' => 500,
'type' => 'php',
'line' => __LINE__,
'file' => __FILE__,
'message' => "Failed to create new user"), TRUE, FALSE);
}
return $user_id;
}