Displaying 'new' on an external page
Posted by DriftN2Forty
|
Displaying 'new' on an external page November 30, 2006 02:58AM |
Registered: 18 years ago Posts: 7 |
|
December 01, 2006 04:32PM |
Admin Registered: 24 years ago Posts: 4,495 |
Possible, yes. Um, its going to be a lot of code though.
Brian - Cowboy Ninja Coder - Personal Blog - Twitter
|
Re: Displaying 'new' on an external page December 01, 2006 09:09PM |
Registered: 18 years ago Posts: 7 |
|
Re: Displaying 'new' on an external page June 01, 2007 01:32PM |
Registered: 18 years ago Posts: 7 |
With the use of quick_auth, i managed my goal with the following
require_once("quick_auth-5.1.2.php");
$conn = mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("phorum", $conn) or die(mysql_error());
$messageRes = mysql_query("SELECT message_id FROM phorum_messages", $conn) or die ( mysql_error() );
$flagRes = mysql_query("SELECT message_id FROM phorum_user_newflags
WHERE user_id = {$USER['user_id']}", $conn) or die ( mysql_error() );
mysql_close($conn);
while($row = mysql_fetch_row($messageRes)) {
$messageIDs[] = $row[0];
}
while($row = mysql_fetch_row($flagRes)) {
$flagIDs[] = $row[0];
}
foreach ( $messageIDs as $MID )
{
$IDPos = array_search( $MID, $flagIDs );
if( $IDPos === FALSE )
$newFlag = "IMAGE TAG OR TEXT HERE";
}
|
June 01, 2007 01:58PM |
Admin Registered: 21 years ago Posts: 8,532 |
Please take a look at the core Phorum code to see how newflags work. Or download the new count module, which implements new counting too. Your code now is bugged.
A message is considered new if its id is not in the newflags table AND if its id is higher than the lowest message id in the newflags table for the forum in which the message resides (this is called "min_id" in the code).
This rule is not implemented, so this will probably cause wrong new message flagging.
Furthermore, it's not really good to simply select *all* message ids from the messages table. That might work while the forums do not have a lot of messages, but imagine what happens if the forums grow.
Another bug could be that non accessable forums are also counted by your code. If all your forums are open for the users, then this is not a problem. But others who might want to use this script could miss the functionality of not counting closed forums.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
A message is considered new if its id is not in the newflags table AND if its id is higher than the lowest message id in the newflags table for the forum in which the message resides (this is called "min_id" in the code).
This rule is not implemented, so this will probably cause wrong new message flagging.
Furthermore, it's not really good to simply select *all* message ids from the messages table. That might work while the forums do not have a lot of messages, but imagine what happens if the forums grow.
Another bug could be that non accessable forums are also counted by your code. If all your forums are open for the users, then this is not a problem. But others who might want to use this script could miss the functionality of not counting closed forums.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: Displaying 'new' on an external page June 01, 2007 03:39PM |
Registered: 18 years ago Posts: 7 |
Sorry, only registered users may post in this forum.