Hot answers tagged comments
2
You can store the data in the user meta as an array of post-id -> comment count at last visit and then simply count the comments since that date, for example
function get_user_comment_count_since_last_visit($user_id ,$post_id){
//only do this for logged in users
if ($user_id <= 0 ){
return 0;
}
/**
* get last comment count ...
1
I found a soloution and what causes it.
It was not really the delimiter that was the problem it was becasue a user made duplicate posts.
Solution:
Replace
$notify_message .= preg_replace('#[\s]+#', ' ',sprintf( get_comment_meta($comment->comment_ID, 'title',1))) .' skrev:'. "\r\n" . $comment->comment_content . "\r\n\r\n";
With
...
1
Your comments.php is included multiple times for some reason. Look for comments_template() – maybe it is called too early.
Each time that happens, PHP tries to create the function comment_theme() again. This cannot work, function names must be unique.
Move the function declaration to the functions.php. So everything including …
<?php
function ...
1
You could try this to skip comments made by user with user_id = 1 in the Recent Comments widget:
add_action( 'widgets_init', 'custom_recent_comments' );
function custom_recent_comments(){
add_filter( 'comments_clauses', 'custom_comments_clauses' );
}
where
function custom_comments_clauses( $clauses ){
$clauses['where'] .= " AND user_id != 1 "; // ...
1
Actually you can include the editor-style.css (or any other stylesheet), just pass a "content_css" value to tinymce that points to a css file:
wp_editor(
$content,
'editablecontent',
array(
'tinymce' => array(
'content_css' => get_stylesheet_directory_uri() . '/editor-styles.css'
)
);
So the original ...
Only top voted, non community-wiki answers of a minimum length are eligible