if your messages were seperated to show sent and received.
you could then see that when someone acknowledges they read
a message, it would disappear from your sent box just like
it does from their received box.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I made a change to the index.php file to accomodate this
request. Now the home page shows an inbox and outbox. When a
user reads a message that you send to them it will remove
itself from your outbox.
FIND LINES 289 TO 321:
<td colspan="4" align="center">Messages</td>
...TO...
<tr><td colspan="4"><a href="message.php">Send a
message</a></td></tr>
Another change I made to help not spoil who was buying
something for you with my new message boxes. Since when you
deleted and item the system would send a message from you to
the person who had reserved/bought an item for you we now
need to screen the messages. These changes send the deleted
messages from who reserved/bought the item and display the
message in the inbox only so they don't see the same message
twice (inbox and outbox). The changes are to index.php and
item.php.
**This only needs to be done if you made the changes that I
previously posted.**
Changes to index.php: Find this in the outbox section (lines
331-336):
$query = "SELECT messageid, users.fullname, message, created " .
"FROM messages " .
"INNER JOIN users ON users.userid = messages.recipient " .
"WHERE messages.sender = " . $userid . " " .
"AND messages.isread = 0 " .
"ORDER BY created DESC";
Logged In: YES
user_id=1044557
Sure, where would this information go?
Logged In: YES
user_id=1044557
Sorry, let me rephrase that: how would you want to be
informed that the message has been read?
Logged In: NO
if your messages were seperated to show sent and received.
you could then see that when someone acknowledges they read
a message, it would disappear from your sent box just like
it does from their received box.
Logged In: YES
user_id=36826
ready for my update to message.php?
Logged In: YES
user_id=1044557
Sure, e-mail me your version.
Logged In: YES
user_id=1177706
I made a change to the index.php file to accomodate this
request. Now the home page shows an inbox and outbox. When a
user reads a message that you send to them it will remove
itself from your outbox.
FIND LINES 289 TO 321:
<td colspan="4" align="center">Messages</td>
...TO...
<tr><td colspan="4"><a href="message.php">Send a
message</a></td></tr>
REPLACE ALL WITH THE FOLLOWING:
<td colspan="4" align="center">Inbox</td>
</tr>
<tr>
<th class="colheader">Date</th>
<th class="colheader">Sender</th>
<th class="colheader">Message</th>
<th> </th>
</tr>
<?php
$query = "SELECT messageid, users.fullname, message, created " .
"FROM messages " .
"INNER JOIN users ON users.userid = messages.sender " .
"WHERE messages.recipient = " . $userid . " " .
"AND messages.isread = 0 " .
"ORDER BY created DESC";
$messages = mysql_query($query) or die("Could not query: " .
mysql_error());
$i = 0;
while ($row = mysql_fetch_array($messages,MYSQL_ASSOC)) {
$messageid = $row["messageid"];
?>
<tr class="<?php echo (!($i++ % 2)) ? "evenrow" : "oddrow"
?>" valign="top">
<td><?php echo strftime("%a, %b
%d",strtotime($row["created"])); ?></td>
<td><?php echo htmlspecialchars($row["fullname"]); ?></td>
<td><?php echo htmlspecialchars($row["message"]); ?></td>
<td align="right"><a
href="index.php?action=ack&messageid=<?php echo $messageid
?>"><img alt="Acknowledge" title="Acknowledge"
src="images/remove.gif" border="0"></a>
</td>
</tr>
<?php
}
mysql_free_result($messages);
?>
</table><br>
<table class="partbox" width="100%" cellspacing="0">
<tr class="partboxtitle">
<td colspan="3" align="center">Outbox</td>
</tr>
<tr>
<th class="colheader">Date</th>
<th class="colheader">Recipient</th>
<th class="colheader">Message</th>
</tr>
<?php
$query = "SELECT messageid, users.fullname, message, created " .
"FROM messages " .
"INNER JOIN users ON users.userid = messages.recipient " .
"WHERE messages.sender = " . $userid . " " .
"AND messages.isread = 0 " .
"ORDER BY created DESC";
$messages = mysql_query($query) or die("Could not query: " .
mysql_error());
$i = 0;
while ($row = mysql_fetch_array($messages,MYSQL_ASSOC)) {
$messageid = $row["messageid"];
?>
<tr class="<?php echo (!($i++ % 2)) ? "evenrow" : "oddrow"
?>" valign="top">
<td><?php echo strftime("%a, %b
%d",strtotime($row["created"])); ?></td>
<td><?php echo htmlspecialchars($row["fullname"]); ?></td>
<td><?php echo htmlspecialchars($row["message"]); ?></td>
</tr>
<?php
}
mysql_free_result($messages);
?>
<tr>
<td colspan="3"><a href="message.php">Send a message</a></td>
</tr>
Logged In: YES
user_id=1177706
Another change I made to help not spoil who was buying
something for you with my new message boxes. Since when you
deleted and item the system would send a message from you to
the person who had reserved/bought an item for you we now
need to screen the messages. These changes send the deleted
messages from who reserved/bought the item and display the
message in the inbox only so they don't see the same message
twice (inbox and outbox). The changes are to index.php and
item.php.
**This only needs to be done if you made the changes that I
previously posted.**
Changes to index.php: Find this in the outbox section (lines
331-336):
$query = "SELECT messageid, users.fullname, message, created " .
"FROM messages " .
"INNER JOIN users ON users.userid = messages.recipient " .
"WHERE messages.sender = " . $userid . " " .
"AND messages.isread = 0 " .
"ORDER BY created DESC";
**INSERT AFTER "AND messages.isread = 0 " .
"AND messages.recipient != " . $userid . " " .
Changes to item.php (line 98) :Replace with this:
$query = "INSERT INTO
messages(sender,recipient,message,created) VALUES(" .
(($boughtid != "") ? $boughtid : $reservedid) . "," .
(($boughtid != "") ? $boughtid : $reservedid) . ",'\"" .
mysql_escape_string($row["description"]) . "\" that you " .
(($boughtid != "") ? "bought" : "reserved") . " for " .
$_SESSION["fullname"] . " has been deleted.','" .
strftime("%Y-%m-%d") . "')";