Hot answers tagged comments
6
It looks like you are overwriting the comment text with your commentimage_comment_text2 filter, try this to append the ratings text:
add_filter( 'comment_text', 'commentimage_comment_text2' );
function commentimage_comment_text2( $comment ){
$rtt = "<br>Rating";
return $comment.$rtt;
}
ps: you forgot the $comment input parameter.
Here is a ...
4
This is a false alarm. Many “Security Programs” do that. That’s called FUD.
WordPress does not check the Referer header, because it is often empty, and real spammers send the site URL as Referer anyway.
But all comment field are sanitized, so no harmful code will be injected. Install an anti-spam plugin, and everything is fine. This report is obviously ...
4
Filter comment_form_field_comment to add a select element with a label.
Add a callback to the action comment_post to save the value.
Filter comment_text to show the value for a comment.
Sample code:
add_filter( 'comment_form_field_comment', function( $field ) {
global $wp_roles;
$user = wp_get_current_user();
$select = ...
2
ok, here is how we solved it together ;-)
We checked the following:
the comments are visible in the backend.
the comment status is approved for all the comments.
we need to use comments_template() in the template file single.php.
remove the extra form (the input fields), since comment_form() is used.
It's informative to view the the TwentyTwelve theme ...
2
You can change the setting in the Discussion post meta box:
(If you can't see this meta box on your post edit screen, go to the Screen Options tab and check the box next to 'Discussion')
Changing this setting will not delete existing comments. It will just turn off the ability to comment as long as the setting is disabled. It only applies to the post you ...
2
The title attribute is hard-coded in comments_popup_link() unfortunately:
echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
What you can do is catching the generated HTML in a variable and replacing the attribute with an empty string:
ob_start();
comments_popup_link();
print preg_replace( '~ title="[^"]+"~', '', ...
1
You can store these values in cookies and fill them when you are creating form inputs.
So in save_comment_meta_data add something like this:
$commenter_data = array(
'phone' => $phone,
...
);
setcookie('commenter_data', serialize($commenter_data), time()+1209600, COOKIEPATH, COOKIE_DOMAIN, false);
And then when you're creating form:
...
1
Quick answer: no. There is not a built-in function to create a new comment status. The status of a comment (or a post/page/attachment/etc) contains wide-spread implications thoughout your Wordpress install, so you couldn't just add one somewhere quickly.
I'm not exactly sure what you're trying to accomplish by adding this new "status", but I think the ...
1
If you want to count the number of posts the user commented on, you can try:
global $wpdb;
$sql = 'SELECT COUNT( comment_ID ) FROM ' . $wpdb->comments . '
WHERE user_id = %d
AND comment_approved = "1"
AND comment_type NOT IN ("pingback", "trackback" )
GROUP by comment_post_ID';
$count = $wpdb->get_var( ...
1
You could use Gravity Forms and generate a draft of a custom post type on submission. The form could contain the URL and all other fields. Nice thing about Gravity Forms is the fields can all be validated and has decent anti-spam measures. It also has hooks to do other tasks such as the post-generation.
When a form submission is received, it can send an ...
1
Replace your jquery with this
<script type="text/javascript">
(function($){
$(document).ready(function() {
var $option = $('.option');
var $fruit = $('.fruit-name');
var $last;
var parent
$option.click(function() {
parent=$(this).parents('.comment-form-rating');
$('.fruit-name',parent).val(this.innerHTML)
})
...
1
In your comments loop, skip the children:
if( !empty( $comment->comment_parent ) ) {
//if the comment has a parent, skip it as it's not level 1
continue;
}
Edit: Above example would only help in the reading loop, below example should help in admin area:
add_filter('the_comments', 'top_level_comments_filter');
function ...
1
assumes that your theme is using comment_class();
example (to be added to functions.php of your theme):
add_filter( 'comment_class', 'comment_class_logged_in_user' );
function comment_class_logged_in_user( $classes ) {
global $comment;
if ( $comment->user_id > 0 && is_user_logged_in() ) {
global $current_user; ...
1
I don't use this plugin, but it looks like this comment template is loaded with
add_filter( 'comments_template', array( 'Facebook_Comments', 'comments_template' ) );
The simplified structure of this comment template looks like:
if ( have_comments() ) :
// ...
wp_list_comments( $_comment_options );
// ...
endif;
$_facebook_comments = ...
1
You can circumvent the check for empty comments easily by adding the uploaded image as HTML to the comment text:
add_action( 'pre_comment_on_post', 'allow_empty_comment_text' );
function allow_empty_comment_text( $text = '' )
{
if ( ! isset ( $_POST['comment'] ) or '' === trim( $_POST['comment'] ) )
{
$img = '/* Process uploaded image here, ...
1
I'm not aware of any WordPress functions that do this, so you can try to play with this kind of query (untested):
function get_custom_user_comments_count( $uid ){
global $wpdb;
$sql = "SELECT COUNT(*) as total
FROM {$wpdb->comments} as c
JOIN {$wpdb->posts} as p ON p.ID = c.comment_post_ID
WHERE ...
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
Disclaimer: I wrote parts of the Akismet WordPress plugin, though not the parts in question here.
Is Akismet failing to connect to the Akismet service, notifying me, and retrying later?
Yes, this is exactly what happens. If Akismet doesn't get a valid response from the servers, it reschedules the check for 20 minutes in the future. In the meantime the ...
Only top voted, non community-wiki answers of a minimum length are eligible