Mark as new
-
Is there any way to mark a new topic and single comment, which has been put inside 24 hours as new.
-
is doable, but I don’t have the time to do – sorry
But could you give advice, which file I should look the function, which I could alter. I can make direct source code editing, if necessary. Better if there could be a hook.
I get this functionality to forum topic listing. It was relative easy. I had made modifications to bbResolutions and I added some new modifications.
if you are happy that you can crate php code to return a true/false status for a what you want, then I might look up a hook for you
Ok.
I edited my version of bbResolution this way:$creationTime=get_the_date(‘U’,$topic_id);
$calculationTime=time()-84600;
if($calculationTime-$creationTime<=0){$dateClass=’ new-topic’;}$resolution = get_topic_resolution_object( $topic_id );
if ( $resolution !== null && ! empty( $resolution->sticker ) ) {
$atts = array(
‘class’ => “{$dateClass} bbr-resolution-sticker bbr-resolution-{$resolution->key}-sticker”,
);return ‘<span’ . get_html_atts( $atts ) .’>’ . $resolution->sticker . ‘</span>’;
}else{
$atts = array(
‘class’ => “{$dateClass} bbr-resolution-{$resolution->key}-sticker”,
);
if($resolution->key) {
return ‘<span’ . get_html_atts( $atts ).$dateClass.’></span>’;
}else {
return ‘<span class=”‘.$dateClass.’ bbr-resolution-sticker bbr-resolution-default-sticker”></span>’;}
}I just would like something similar for individual forum posts.
I changed …/bbpress/templates/default/loop-single-reply.php this way:
<div class=”bbp-reply-content”><div style=”position:relative”><span class=”cont-id-<?php
$creationTime=get_the_date(‘U’,bbp_reply_id());
$calculationTime=time()-84600;
if($calculationTime-$creationTime<=0){echo ‘ new-single-topic’;}?>”></span></div>This was easy task. I just wonder, why this is not coded originally. Missing indeed setting for time how much new reply is new.
I just don’t understand why also the id is prited. The result is for example:
span class=”cont-id-15941 new-single-topic”
-
This reply was modified 6 years, 8 months ago by
tapiohuuhaa.
sorry I didn’t write bbpress so cannot say why
Ok. It comes from bbp_reply_id().
I created reference to that function
$creationTime=get_the_date(‘U’,bbp_reply_id());I just not expected that the function automatic add the id of the record.
The result looks currently like this: https://www.sanaristikkofoorumi.net/wordpress/wp-content/uploads/2019-10-11-15.19.00-www.sanaristikkofoorumi.net-9159724b8d94-300×37.png
-
This reply was modified 6 years, 8 months ago by
tapiohuuhaa.
-
This reply was modified 6 years, 8 months ago by
tapiohuuhaa.
-
This reply was modified 6 years, 8 months ago by
The topic ‘Mark as new’ is closed to new replies.