Skip to:
Content
Pages
Categories
Search
Top
Bottom

List of all new topics since last visit

Viewing 4 replies - 1 through 4 (of 4 total)

  • Robkk
    Moderator

    @robkk

    i dont know about listing it but you might be able to highlight them either using this plugin to show only to keymasters or moderators, or modify it to show to everyone

    https://wordpress.org/plugins/bbpress-new-topics/

    or somehow edit this function from here to add labels to each topic post type

    http://www.wpbeginner.com/wp-themes/how-to-highlight-new-posts-for-returning-visitors-in-wordpress/

    PHP

    function wpb_lastvisit_the_title ( $title, $id ) {
    
    if ( !in_the_loop() || is_singular() || get_post_type( $id ) == 'page' ) return $title;
    
    // if no cookie then just return the title 
    
    if ( !isset($_COOKIE['lastvisit']) ||  $_COOKIE['lastvisit'] == '' ) return $title;
    $lastvisit = $_COOKIE['lastvisit'];
    $publish_date = get_post_time( 'U', true, $id );
    if ($publish_date > $lastvisit) $title .= '<span class="new-article">New</span>';
    return $title;
     
    }
    
    add_filter( 'the_title', 'wpb_lastvisit_the_title', 10, 2);
     
    // Set the lastvisit cookie 
    
    function wpb_lastvisit_set_cookie() {
    
    if ( is_admin() ) return;
    $current = current_time( 'timestamp', 1);
    setcookie( 'lastvisit', $current, time()+60+60*24*7, COOKIEPATH, COOKIE_DOMAIN );
    }
    
    add_action( 'init', 'wpb_lastvisit_set_cookie' );
    

    CSS

    .new-article { 
    background: #feffdd;
    padding: 3px;
    border: 1px solid #eeefd2;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    margin-left:5px;
    font-size: small;
    font-weight: bold;
    }

    or i guess an alternative is get an unread posts plugin like

    https://wordpress.org/plugins/bbpress-mark-as-read/

    which lists all the unread topics in there profile.


    divyesh25
    Participant

    @divyesh25

    thanks robkk for reply. its nice solution but i want to list topics without used of cookie.

    if any other solution then please suggest me..

    thanks


    Robkk
    Moderator

    @robkk

    @divyesh25 other than all that i have no idea, i guess wait til someone else has a suggestion to help you out on this

    I added a couple of other plugins that do this a couple of days ago to the following page:

    Check them out and let us know if one (or more) do what you are after

    https://codex.bbpress.org/feature-plugins-tracking/

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