MattF wrote:bingiman wrote:Well I am hoping so as well, but it doesn't' look good. As far as I can see no one is willing to lend a hand.
It has nothing to do with willingness. There are things one has to do outside of the forums, you know.
Surkow, those numbers are array locators. Check above that code you posted, and you'll see where the $sfdb array is created.
I'll have another look at this when I have the chance, but I am a tad pulled out at the moment with other things.
I looked up that part of the code and I now understand what it tries to do.
$sfdb[$sfcount][0] = $current['parent_forum_id'];
$sfdb[$sfcount][5] = $current['last_post'];
And the relevant part of the code:
if ($cur_forum['fid'] == $sub_forums[0] && !$pun_user['is_guest'] && $sub_forums[5] > $pun_user['last_visit'])
So if the current forum id is the same as the parent forum id (forum categories can have parent forums if they are subforums), the user isn't a guest and the last post of the subforums is greater than the post from the last post of the category itself it will display a new post icon.
Edit:
If I change it to:
if ($cur_forum['fid'] == $sub_forums[0] && !$pun_user['is_guest'] && forum_is_new($cur_forum['fid'], $cur_forum['last_post']))
It tries to find out if you've already read the last posts in the parent forum. This way the only thing that needs to be added is a check for the subforums (so it's partly working now).
So now the question...how do I get the info from the subforums to see if the posts are read? I know there is a while with "$cur_subforum = $db->fetch_assoc($subforum_result)" in it. The query for $subforum_result is:
$subforum_result = $db->query('SELECT f.forum_desc, f.forum_name, f.id, f.last_post, f.last_post_id, f.last_poster, f.moderators, f.num_posts, f.num_topics, f.redirect_url, p.poster_id AS last_poster_id FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'posts AS p ON (p.id=f.last_post_id) WHERE parent_forum_id='.$id.' ORDER BY disp_position') or error('Unable to fetch sub forum info',__FILE__,__LINE__,$db->error());
Edit2:
Also a thing to remember is that the forum categories that are subforums are just normal categories that are hidden and are linked to a parent forum. It would be nice if someone could help to create a query that checks if the subforums from a parent forum have posts that are read.