Hi - I have your BBpress plugin at http://www.spreadtraderpro.com/bbpress
I'm not a coder so I wou;d be interested if someone would give me a price to add a small icon where posts are unread.
Version: 0.9.3
Last Updated: 2008-11-17
Requires bbPress Version: 0.8 or higher
Compatible up to: 0.9





Hi - I have your BBpress plugin at http://www.spreadtraderpro.com/bbpress
I'm not a coder so I wou;d be interested if someone would give me a price to add a small icon where posts are unread.
Out of interest does this work with version 1? (it says compatible up to 0.9 but some of those seem to work ok on 1)
I would be very surprised if this worked on 1.0 right now. It's fairly complex.
I use 1.0.1 and I have to click twice to update all topics read, and the bold link takes me to the last post.
Is this because I use 1.0 ?
And Is there a way to flag the topic automatically as read after looking at it?
For now they keep higlighted until i clear all posts read.
And on a sidenote, It would be nice with a function to mark specific threads as read too instead of everone at the same time.
I saw on bbshowcase.org the ability to view all unread topics via a single button.
How can I achieve that too?
I'm seeing the same behavior as anandasama on my 1.0.2 install.
I think there may be a logic flaw in the plugin. Hopefully, _ck_ will comment.
When you click the mark as read link, it updates the bb_usermeta table and sets the new up_last_login time. The update prepends the current time to the current value and separates them with a |. So you get something like this:
new_last_login_time| old_last_login_time
When the code then tried to read back out last_login_time it does this:
$up_last_login=trim(end(explode("|","|".$user->up_last_login)));
So what it actually fetches is the old_last_login time. This is what is causing the weird behavior. The plugin is using the old login time instead of the new one so it then shows all posts since the old login time as being unread. When you click the mark as read link a second time, you overwrite the values again so that's why the unread highlights finally go away.
A way to fix this would be to change the code to be this:
$up_last_login = trim(reset(explode("|",$user->up_last_login)));
This will make the code fetch the new login time instead.
Just an update. I think _ck_ 's code is probably fine. What I discovered is that the up_last_login time wasn't being updated when my users were logging in.
The plugin uses the action bb_user_login to update the login time. But if you are using some other login integration (like me) and the bb_login function is never called, then the login time will not be updated (except when you click the Mark all as read link).
I fixed my code login code (which only calls set_auth_cookie) to have the do_action call for bb_user_login and now it is working fine.
I've noticed that (for me) this plugin doesn't actually count a brand-new topic as a new post. So while topics with new posts show up bold, new topics don't show up bold. Any way to add this functionality? I'm using 0.9.0.6 on a Linux system (MediaTemple shared hosting).
Using BBpress 1.0.2
As stated by citizenkeith i have the same issue but only when using this on the forumlist.
New topics do not show with span tags only new posts to old topics.
Every thing works great when using this plugin on latest descusion though new posts and topics show.
Im assuming the error is because of the newer version of bbpress and im guessing the error is somewhere in these lines
function up_mark_forum_unread($item) {
global $bbdb,$bb_current_user, $forum, $unread_posts,$up_last_login,$up_forums,$up_last_login_forums;
if (!isset($up_forums)) { // unfortunately requires an extra query, data impossible to store
$user = bb_get_user($bb_current_user->ID);
if ($user->up_read_topics) {$up_forums=@$bbdb->get_col("SELECT DISTINCT forum_id FROM $bbdb->topics WHERE topic_id IN (".trim($user->up_read_topics,", ").") AND topic_last_post_id NOT IN (".trim($user->up_last_posts,", ").") ");}
if (is_array($up_forums)) {$up_forums=array_flip($up_forums);} else {$up_forums=array();}
if ($unread_posts['indicate_last_login'] && !isset($up_last_login_forums)) { // unfortunately requires an extra query, data impossible to store
$up_last_login_forums=@$bbdb->get_col("SELECT DISTINCT forum_id FROM $bbdb->topics WHERE topic_time >= '".gmdate('Y-m-d H:i:s',$up_last_login)."' "
.(($user->up_read_topics) ? "AND topic_id NOT IN (".trim($user->up_read_topics,", ").")" : "") );
if (is_array($up_last_login_forums)) {$up_last_login_forums=array_flip($up_last_login_forums);} else {$up_last_login_forums=array();}
}
}
if ($unread_posts['use_row_class']) {
if (isset($up_forums[$forum->forum_id])) {$item=rtrim($item,'" ').' unread_posts_row"';}
elseif ($unread_posts['indicate_last_login'] && isset($up_last_login_forums[$forum->forum_id])) {$item=rtrim($item,'" ').' unread_login_row"';}
} else {
if (isset($up_forums[$forum->forum_id])) {$item = '<span class="unread_posts">' . $item . '</span>';}
elseif ($unread_posts['indicate_last_login'] && isset($up_last_login_forums[$forum->forum_id])) {$item = '<span class="unread_login">' . $item . '</span>';}
}
return $item;
}i'm using this plugin, many thanx for all the effort but..
why doesn't it work out with subforums
i need to be the parrent also highlighted when there is a new post in the child forums
You must log in to post.