Skip to:
Content
Pages
Categories
Search
Top
Bottom

Request: Posts since last visit

  • I was wondering if it where possible to create a view that would show a user all the posts that had activity since the last visit.

    I know favorites and rss is great and all but many people just aren’t used to these new techs.

Viewing 25 replies - 1 through 25 (of 26 total)

  • thomasklaiber
    Member

    @thomasklaiber

    Ahh .. didn’t think of this feature yet. But with my Onlinelist Plugin I think it’s easy to add this to the Views section.

    If somebody hasn’t started working on this, I’ll do it?!

    if you’re going to work on that thomas, you might as well add the ability to determine if a thread has posts you haven’t seen. This was something I was going to work on at some point (I think it’s prioritized 3rd or 4th for me).

    I was thinking about doing it with cookies, but I could see your plugin being used to do it in the database.


    thomasklaiber
    Member

    @thomasklaiber

    I think I’ll do it with cookies, too. I just played around a little bit with my onlinelist plugin and it isn’t a good idea to use it as base for this.

    If I use cookies it’s independet from the plugin and will work better.

    I’ll keep your idea with the seen posts in mind.

    Yes cookies would have to be the way to go. Since I only know C I understand a bit of PHP but when SQL and Cookies start poping up I can’t get much further…

    Thanks for the interest, in my opinion this feature is a must have since virtually every forum software uses something like this so many people are expecting the feature.

    hum… just had this idea: what about posts since yesterday?


    thomasklaiber
    Member

    @thomasklaiber

    This is just something a lot easyer to do. It requires just a small plugin, I’ll make one for this, ok? :)

    The posts since last visit plugin is getting a bit more complicated then I thought. I’m doing it as plugin for my onlinelist plugin, cause I think doing this database driven is better … so you can view the posts since your last visit anywhere.

    If you want to see how it looks like at the moment, go to

    http://la-school.com/bbpress/ (Test / test) … not sure if you can really try it :D

    Ultimately the plugin should have the choice of cookies or database… or just two separate plugins that do it, one using cookies and one using the database. For small to medium size forums, the database method will be fine, but once you get to the point where you have thousands of people accessing the site, the database driven method will bog down the server.

    The cookies method shouldn’t be too difficult… I was researching it a couple weeks ago and php has good cookie handling.

    If you end up doing it using the database method, I might still do it using the cookie method. Please don’t fully integrate it into your online list so that people can have a choice…. make it an additional plugin that uses your online list (if that’s how you’re doing it)


    thomasklaiber
    Member

    @thomasklaiber

    It will definitly be an additional plugin. But it won’t work without the onlinelist plugin installed. :)

    It uses the Onlinelist db to retrieve the users last visit to the forum, this was the easyest method for me to handle it. This version of the plugin will be a super-simple version of this feature.

    If you want to take a look at it:

    http://la-school.com/2006/downloads/BETA_since-last-visit.zip

    By doing it I thought about doing a second plugin which uses cookies and wont need the onlinelist plugin?! If you haven’t started working on this, I’ll do it?

    I haven’t, I was just researching it for future work on the plugin. There are still a few others I want to do first (if I can ever get the time to sit down and start programming again).

    Let us know how it goes.

    I tested this out and it works great! It seems to work the way you intended for sure! Couple of things:

    1) If there are no posts, could there be a message like ” You have seen all posts since your last visit!”

    2) Could there be a way to call the link with a function so you could also place it wherever you wanted?

    3) Could we get a functionality if the person is a new visiter and hasn’t registered anything in the DB for their last visit time. Maybe show ‘all posts’ or a certain number anyways!

    4) Could we borrow the paging functionality and (posts per page) from Ardentfrost’s Memberlist plugin (0.73c) for the views page?

    5) How DB intensive is this and the online plugin (for curiousity!)

    Look at me! Greedy already! Great plugin Thomas!

    Thanks,

    Trent


    thomasklaiber
    Member

    @thomasklaiber

    Thanks for this super great feedback Trent!

    1) This is something my plugin can’t do. You have to change the views-template, because this message is also missing in any other view without contents. Maybe something for a trac-ticket?

    Just add

    <?php else: ?>

    <p>Sorry, no matching posts found!</p>

    in front of the last <?php endif; ?> in the views template.

    2) I’ll implement a function for this :)

    3) Maybe like the latest discussions on the front-page? … Yeah, it’s a good idea instead of leaving it blank!

    4) Donno exactly. When I look at the views-code there seems to be paging functionality already?!

    5) I thought of this issue, too. It adds a few queries on every page refresh, but I have no idea how to optimize this.

    Thanks again man!

    You should be able to do request 1 similarly to how I do it with the private message plugin. You fill the string separately, then just call it to be displayed. I haven’t looked at your code yet, but you should be able to have a function that does the if/else for you, then just call it from where you want the link placed.

    I tried the beta but it doesn’t seem to be working for me :( I have the onlinelist plugin and me and a friend of mine tried it like this:

    one made a post while the other wasn’t on the website (even the browsers where closed) and 5 minutes latter the other went to the site and tried to use the function.

    The result? a blank page :(

    http://www.ngagept.net/forum

    What happens if a user stays logged in and doesn’t ever log out. Will this do anything to the results? Even if they close down their computers and come back 2 days later? Since this isn’t on cookies, how does it know what is (since last visit) anyways?

    Trent


    thomasklaiber
    Member

    @thomasklaiber

    If you are inactive for more than 5 minutes, you’re marked as offline. So if you go to the forum again later your last_visit is the time when you were there the time before.

    (ehm .. sry… it’s hard for me to describe in english)

    d3x7r0:

    Strange … for me it works at the moment. Maybe some time problems … try removing the -3600 from line 53.

    Just remember, this is beta! (maybe… alpha :D )

    That explains it! Thanks

    Trent

    I just took a look at both codes and noticed that in the onlinelist plugin you’re using – 300 and on this one – 3600, notice the diference? :P

    5 minutes versus 1 hour! Bit of a difference!

    Trent

    hum… just noticed something: My username isn’t showing up in the Users Online list… maybe it has something to do with that :?


    thomasklaiber
    Member

    @thomasklaiber

    Hehe … which bbpress version are you using? Stable release or trac version?

    If you’re using the stable version (0.73), line 48 should look like this:

    add_action('init', 'online_update');

    Just a thought …

    The thing with the time, 5 minutes and 1 hour is something different :-D The 5 minutes are the timeout for inactivity … so if you inactive for more then 5 minutes, you’re not longer displayed as online.

    The one hour thing was to let the plugin work on my board, I think there seems to be a little problem with the timezones. Just try removing it … the -3600 and see if it works then.

    cheers.

    In bb_press 0.74 you need to change “init” to “bb_init” on line 48. Like this:

    add_action(‘bb_init’, ‘online_update’);

    And then it works again. ;)


    thomasklaiber
    Member

    @thomasklaiber

    Download the updated beta version here:

    https://plugins-dev.bbpress.org/browser/posts-since-last-visit/trunk/since-last-visit.php?format=raw

    Demo here:

    http://la-school.com/bbpress/ (Test/test)

    It requires Onlinelist 1.4 to work!!

    As requested in another thread here, If you want to indicate new posts with an icon next to the topic do it this way:

    <?php if ($topic->topic_time > view_since_last_visit_user()) : ?>

    DISPLAY IF NEW

    <?php else : ?>

    DISPLAY IF NOT NEW

    <?php endif; ?>

    add this in front of you topic title.

    At the moment the topic still stay “new” even if you’ve already seen it, till the next visit. Gonna fix this in next version.

    Any Feedback?

    I will test this out for sure and get back to you later on when I get a chance! Looks good so far! Just need to test out the new features!

    Trent


    mrpapasworld
    Member

    @mrpapasworld

    Seems to be working just fine…


    davidbessler
    Member

    @davidbessler

    Problem: With forum restriction, I use the following code to filter topics with the default views:

    function forum_restriction_list_of_allowed_forums($user) {

    global $forum_restriction_allowed_in_forum,$bb_current_user;

    foreach ($forum_restriction_allowed_in_forum as $forum_number => $forum_memberlist){

    if (ereg(get_user_name($user),$forum_memberlist) || $forum_memberlist ==''){

    $list_of_allowed_forums .= "'".$forum_number."',";

    }

    }

    $list_of_allowed_forums = rtrim($list_of_allowed_forums,",");

    return $list_of_allowed_forums;

    }

    // FILTER TOPICS

    function forum_restriction_get_latest_topics_where( $where ) {

    if (bb_is_user_logged_in()) {

    global $bb_current_user;

    $list_of_allowed_forums = forum_restriction_list_of_allowed_forums($bb_current_user->ID);

    $where .= " AND forum_id IN ($list_of_allowed_forums) ";

    echo "where is set to: $where";

    return $where;

    } else {

    return $where;

    }

    }

    add_filter ( 'get_latest_topics_where', 'forum_restriction_get_latest_topics_where' );

    The problem is this doesn’t work with bb_custom_views used by since-last-visit.php. It seems the plugin changes the $where AFTER forum-restriction has already tried to filter the $where.

    How do I get forum_restriction_get_latest_topic_where to add ” AND forum_id IN ($list_of_allowed_forums) ” to $where AFTER since-last-post sets $where?

    Kapish?

Viewing 25 replies - 1 through 25 (of 26 total)
  • You must be logged in to reply to this topic.
Skip to toolbar