Skip to:
Content
Pages
Categories
Search
Top
Bottom

Indicating new posts/topics plugin request. Coder needed!

  • Is there a way to either modify the “Indicate New Posts” plugin, or inspire someone to make a plugin, so that i can add something like this in my theme:

    <?php if ($newpost) : ?>

    NEW

    <?php else : ?>

    OLD

    <?php endif; ?>

    I have looked all over google – and on this site – for a plugin that allowed me to see new posts/topics when i visit my forum, but so far the only one i could find is the “Indicate…”. In all honesty, i can’t use bold marked topics for much.. i need something more CSS like, something not only affecting the topic.

    I’ve coded themes for phpBB for years, but i recently found bbPress and i just love how simple and easy it is to code themes here. With a plugin to display new posts/topics (which in my own humble opinion SHOULD be standard in bbPress), i could gladly help spreading the word of a (relatively) new BB, by making some new themes.

    If i could decide the function entirely, it should work in such way that both new topics as well as new posts would be affected, and they would continue to show as unread until i actually read them. Also, it should be database driven, so that i could log in to my account on another computer, and still see the posts/topics that would be new for me.

    Please don’t make me go back to phpBB… :)

Viewing 10 replies - 1 through 10 (of 10 total)
  • Do you want it CSS-driven? It’s trivial to modify the Indicate New plugin. Just look for where it says <strong> and </strong> (near the bottom) and change that to <span class="new"> and </span>. You can then use content-before to add the NEW or do whatever else.

    What’s new and what isn’t isn’t yet implemented. :)

    Hi fel.

    I already modified the -strong- part, to some <span style=”color: #123456;”>, but i have to admit that i have never heard of the content-before tag for CSS.

    I looked at google, i guess the tag looks like :before (or :after), but i also found this page:

    http://www.quirksmode.org/css/contents.html

    .. which states that it doesn’t work in IE browsers. FreekinĀ“ Microsoft..

    Good idea though, but unfortunately IE is too popular.

    In my theme i have a table, with two columns. First column is the one i would like to be able to modify (even if only with a CSS tag), second column holds the title of the topic.

    Do you know if it would be possible to modify the plugin to differentiate between a .no_new_topic and a .new_topic class, for use in CSS instead?

    I think it should not be hard to code such a plugin. It would have to create a new database table, like bb_read, with the following fields:

    – bb_user

    – bb_post

    – bb_last_comment_read

    This way you could modify the posts query, left joining it with this table. If the join is NULL (please correct me if i’m wrong, i haven’t done these things in a lot of time), then the user has never read the post. If bb_last_comment_read is less than the actual number of comments or replies, then he hasn’t read the last post.

    Another interesting alternative is what the folks at wordpress.org are doing … for non-visited links they have a font with a font-weight: bold style. So you can see which topics are new.

    I have never coded sql, but i agree for some unknown reason that i don’t think it’s difficult to code. I’m just curious as to why noone ever did so before. In my opinion, this is the only obstacle in bbPress.

    If anyone should decide to give this a go and try to make the plugin, i just have one (more?) request.. and that is that the plugin also indicates a new topic in the forums part, and not only in the latest discussions. The Indicate New Posts plugin fails to do this.

    Who do i have to sleep with to get this plugin? :D

    I don’t know who you have to sleep with to get _that_ plugin. It’s not me. I’m shying away from implementing it because I’m not sure what a good method is.

    Do you know if it would be possible to modify the plugin to differentiate between a .no_new_topic and a .new_topic class, for use in CSS instead?

    Yeah. Change the function fel_indicatenew() to this (note that I’m using classes ‘no-new-topic’ and ‘new-topic’ here):

    function fel_indicatenew($title)
    {
    global $topic, $bb_current_user;
    if ( bb_is_user_logged_in() )
    {
    $feluser = bb_get_user($bb_current_user->ID);
    if( ($topic->topic_time > $feluser->last_visit) && ( $topic->topic_last_poster != $feluser->ID ) )
    {
    $title = '<span class="new-topic">' . $title . '</span>';
    } else {
    $title = '<span class="no-new-topic">' . $title . '</span>';
    }
    }
    return($title);
    }

    Oh, amazing … i feel like Tom from Tom & Jerry :p

    Then i’m Jerry.

    Fel, i think you misunderstood me with the new-post class. I wanted it away from the title, as a new variable of some sort. I guess this plugin is only for the topic text, and can not be modified to my wishes.

    What do Tom and Jerry have to do with any of this?

    So replace the code that adds the <span class=””> to this:

    $topic->new = true;

    Then when you want to find out if it’s a new topic, you do this:

    if( $topic->new ) {
    //blah
    }

    Should work. Unless I misunderstood your wishes again.

    I’m not sure i’m doing it right. The idea is good, but nothing seems to happen. Here’s what i have:

    In the plugin:

    function fel_indicatenew($title)
    {
    global $topic, $bb_current_user;
    if ( bb_is_user_logged_in() )
    {
    $feluser = bb_get_user($bb_current_user->ID);
    if( ($topic->topic_time > $feluser->last_visit) && ( $topic->topic_last_poster != $feluser->ID ) )
    {
    //$title = '<span style="color: #9d0a0e;">' . $title . '</span>';
    $topic->new = true;
    }
    }
    return($title);
    }

    .. and in the theme’s front-page.php:

    <?php if( $topic->new ) : ?>
    blah
    <?php endif; ?>

    I’ve also tried:

    <?php if( $topic->new ) { ?>
    blah
    <?php } ?>

    .. but none of these seem to do anything.

    In the right place in front-page.php? It has to be inside the loops that go foreach( $sumthin AS $topic ) { ... }

    I’ve just tried it myself and it seems to work. Comment _in_ that line about the span colour so you can test if it’s working at all.

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