2009-09-04, 03:01 AM
So, I have been working on a Dashboard for my site.
I want it to list the threads that the user is subscribed to, but has new posts.
The odd thing is, it works for me, somewhat. But signed in as another user, its terribly messed up.
Here is what it looks like from my perspective...
When I have no new posts in threads I participated in: http://screencast.com/t/4pPmhJCQ
When people have posted in threads that I did: http://screencast.com/t/tU39Xii5
As you can see, the feature looks perfectly fine. But, it only works for one thread (tid=1) and one user (uid=1)
I log into my test account, I see this: http://screencast.com/t/FWbxXRcMC0FI
There is two pieces of code for this, one to determine the number by the dashboard link, "dashboard (#)" and the other is to list the threads.
Dashboard link code:
And here is the code to list the threads.
If anyone can help, it would be much appreciated
I want it to list the threads that the user is subscribed to, but has new posts.
The odd thing is, it works for me, somewhat. But signed in as another user, its terribly messed up.
Here is what it looks like from my perspective...
When I have no new posts in threads I participated in: http://screencast.com/t/4pPmhJCQ
When people have posted in threads that I did: http://screencast.com/t/tU39Xii5
As you can see, the feature looks perfectly fine. But, it only works for one thread (tid=1) and one user (uid=1)
I log into my test account, I see this: http://screencast.com/t/FWbxXRcMC0FI
There is two pieces of code for this, one to determine the number by the dashboard link, "dashboard (#)" and the other is to list the threads.
Dashboard link code:
<?php
$get_threads = $db->query("SELECT * FROM CENSORED_threadsubscriptions WHERE uid='".$mybb->user['uid']."'") or die($db->error());
$s = $db->fetch_array($get_threads);
$get_info_from = $db->query("SELECT * FROM CENSORED_threads WHERE tid='".$s['tid']."'") or die($db->error());
$thread_c = $db->fetch_array($get_info_from);
if($thread_c['lastposteruid'] != $mybb->user['uid'])
{
$dashthreads = 1;
}
$num_dash = count($dashthreads);
?>
And here is the code to list the threads.
<?php
$get_threads = $db->query("SELECT * FROM CENSORED_threadsubscriptions WHERE uid='".$mybb->user['uid']."' ORDER BY sid DESC") or die($db->error());
while($s = $db->fetch_array($get_threads))
{
$get_info_from = $db->query("SELECT * FROM CENSORED_threads WHERE tid='".$s['tid']."'") or die($db->error());
$thread = $db->fetch_array($get_info_from);
if($thread['lastposteruid'] != $mybb->user['uid'])
{
$threads = '<div style="display: block;"><a href="./showthread.php?tid='.$thread['tid'].'"><img src="./images/star.gif" border="0" /> <strong>'.$thread['subject'].'</strong></a> <span style="color: #666;"><em>has new comments.</em></span></div>';
}
if(count($threads) == 0) {
$threads = 'No threads you have posted in have been replied to.';
}
}
?>
If anyone can help, it would be much appreciated