diff --git a/public_html/lists/admin/exportuserdata.php b/public_html/lists/admin/exportuserdata.php
index d5357e41a..77bc6945b 100644
--- a/public_html/lists/admin/exportuserdata.php
+++ b/public_html/lists/admin/exportuserdata.php
@@ -233,7 +233,7 @@
FROM
'.$GLOBALS['tables']['user_message_forward'].'
WHERE
- USER = '.sprintf('%d', $user['id'])
+ USERID = '.sprintf('%d', $user['id'])
);
$totalForwards = Sql_Num_Rows( $forwardrows );
diff --git a/public_html/lists/admin/inc/userlib.php b/public_html/lists/admin/inc/userlib.php
index da8eb273c..183fcfc70 100644
--- a/public_html/lists/admin/inc/userlib.php
+++ b/public_html/lists/admin/inc/userlib.php
@@ -136,7 +136,7 @@ function deleteUserRecordsLeaveBlacklistRecords($id)
Sql_Query('delete from '.$tables['user_attribute'].' where userid = '.$id);
Sql_Query('delete from '.$tables['user_history'].' where userid = '.$id);
Sql_Query('delete from '.$tables['user_message_bounce'].' where user = '.$id);
- Sql_Query('delete from '.$tables['user_message_forward'].' where user = '.$id);
+ Sql_Query('delete from '.$tables['user_message_forward'].' where userid = '.$id);
Sql_Query('delete from '.$tables['user'].' where id = '.$id);
Sql_Query('delete from '.$tables['user_message_view'].' where userid = '.$id);
}
diff --git a/public_html/lists/admin/structure.php b/public_html/lists/admin/structure.php
index 703f3e9c1..3382f7893 100644
--- a/public_html/lists/admin/structure.php
+++ b/public_html/lists/admin/structure.php
@@ -269,13 +269,13 @@
),
'user_message_forward' => array(
'id' => array('integer not null primary key auto_increment', 'ID'),
- 'user' => array('integer not null', 'subscriber ID'),
+ 'userid' => array('integer not null', 'subscriber ID'),
'message' => array('integer not null', 'Message ID'),
'forward' => array('varchar(255)', 'Forward email'),
'status' => array('varchar(255)', 'Status of forward'),
'time' => array('timestamp', 'When was it forwarded'),
- 'index_1' => array('usermessageidx (user,message)', 'index'),
- 'index_2' => array('useridx (user)', 'index'),
+ 'index_1' => array('usermessageidx (userid,message)', 'index'),
+ 'index_2' => array('useridx (userid)', 'index'),
'index_3' => array('messageidx (message)', 'index'),
),
'config' => array(
diff --git a/public_html/lists/admin/upgrade.php b/public_html/lists/admin/upgrade.php
index b10e9697b..b516663a6 100644
--- a/public_html/lists/admin/upgrade.php
+++ b/public_html/lists/admin/upgrade.php
@@ -468,6 +468,15 @@ function output($message)
Sql_Query("alter table {$GLOBALS['tables']['admin']} modify modifiedby varchar(66) default ''");
}
+ if (Sql_Table_Column_Exists($GLOBALS['tables']['user_message_forward'],'user')) {
+ Sql_Query('drop index usermessageidx on '.$GLOBALS['tables']['user_message_forward']);
+ Sql_Query('drop index useridx on '.$GLOBALS['tables']['user_message_forward']);
+ Sql_Query('alter table '.$GLOBALS['tables']['user_message_forward'].' change column user userid integer not null');
+ Sql_Query('alter table '.$GLOBALS['tables']['user_message_forward'].' add index usermessageidx (userid,message)');
+ Sql_Query('alter table '.$GLOBALS['tables']['user_message_forward'].' add index useridx (userid)');
+ Sql_Query('drop index useridx on '.$GLOBALS['tables']['user_message_forward']);
+ }
+
//# longblobs are better at mixing character encoding. We don't know the encoding of anything we may want to store in cache
//# before converting, it's quickest to clear the cache
clearPageCache();
diff --git a/public_html/lists/index.php b/public_html/lists/index.php
index 10b00fd05..a22c443f2 100644
--- a/public_html/lists/index.php
+++ b/public_html/lists/index.php
@@ -1058,7 +1058,7 @@ function forwardPage($id)
$forwardemail = '';
if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) {
$firstpage = 0;
- $forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(user) from %s where date_add(time,interval %s) >= now() and user = %d and status ="sent" ',
+ $forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(userid) from %s where date_add(time,interval %s) >= now() and userid = %d and status ="sent" ',
$tables['user_message_forward'], FORWARD_EMAIL_PERIOD, $userdata['id']));
$forwardemail = stripslashes($_REQUEST['email']);
$emails = explode("\n", $forwardemail);
@@ -1126,7 +1126,7 @@ function forwardPage($id)
foreach ($emails as $index => $email) {
//0011860: forward to friend, multiple emails
- $done = Sql_Fetch_Array_Query(sprintf('select user,status,time from %s where forward = "%s" and message = %d',
+ $done = Sql_Fetch_Array_Query(sprintf('select userid,status,time from %s where forward = "%s" and message = %d',
$tables['user_message_forward'], $email, $mid));
$info .= '
'.$email.': ';
if ($done['status'] === 'sent') {
@@ -1145,7 +1145,7 @@ function forwardPage($id)
sendAdminCopy(s('Message Forwarded'),
s('%s has forwarded message %d to %s', $userdata['email'], $mid, $email),
$messagelists);
- Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
+ Sql_Query(sprintf('insert into %s (userid,message,forward,status,time)
values(%d,%d,"%s","sent",now())',
$tables['user_message_forward'], $userdata['id'], $mid, $email));
if ($iCountFriends) {
@@ -1156,7 +1156,7 @@ function forwardPage($id)
sendAdminCopy(s('Message Forwarded'),
s('%s tried forwarding message %d to %s but failed', $userdata['email'], $mid, $email),
$messagelists);
- Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
+ Sql_Query(sprintf('insert into %s (userid,message,forward,status,time)
values(%d,%d,"%s","failed",now())',
$tables['user_message_forward'], $userdata['id'], $mid, $email));
$ok = false;