Quantcast
Channel: bbPress.org » All Posts
Viewing all articles
Browse latest Browse all 3669

Reply To: List of all new topics since last visit

$
0
0

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.


Viewing all articles
Browse latest Browse all 3669

Trending Articles