Tag Info

Hot answers tagged

14

For my blog, I too run Akismet to catch any spam that is posted to my blog, but I also prevent spam from being posted in the first place using a few plugins: Cookies For Comments requires that people leaving comments have cookies and CSS stylesheets enabled. A stylesheet is added to your site that when loaded sets a cookie. This cookie is then looked for ...


14

Windows Live Writer Windows Live Writer (WLW) is hands down the best, if you are on Windows. One of the things I love about it is its plugin architecture and how many people have written useful plugins for WLW. Qumana I searched far and wide for an equivalent on the Mac and didn't find a match but came close: Qumana: Qumana still can't touch WLW ...


14

There are numerous different ways to accomplish this, some more polished than others and practically all of them with potential for conflict with other plugins, but ignoring all that here's one way that is pretty close to what you asked for. :) This solution will support a URL format like the following where %comment_id% is the numeric ID of your comment ...


14

Here is a list of all of the above answers and a removal of the admin bar link. Just add it to your themes function file or make it a plugin. I will mark this as a community wiki as everyone's answer is right just no one added it all together. <?php // Removes from admin menu add_action( 'admin_menu', 'my_remove_admin_menus' ); function ...


12

The check if comments are enabled is performed by comments_open() function. You can make it always return false via a filter with something like this: add_filter('comments_open', '__return_false'); Other way would be to make comments available to only registered users (that is if you don't have open registration) in Settings > Discussion.


11

Click on Screen options in the top right corner of the screen. And select Discussion. Than you'll see that checkbox to enable/disable comments.


10

On the Akismet side, a few things to note. First, in wp-admin under 'Plugins -> Akismet Configuration' is everything green? You mentioned that you confirmed the API key is correct. Did you check the 'Server Connectivity' section? All of the IP addresses listed should be green. If not then you server isn't able to make the needed requests to akismet.com ...


10

Hi @Towfiq: Comments are related in the database to Posts. You'll have to do a lot of work to get Comments to relate to Users. Have you considered creating a Custom Post Type for Users and then use either a user_meta field to store the post_id, or a postmeta field to store the user_id, or both? If you did that then you would get the comments with no effort ...


10

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 ...


9

When you create a new post(custom type or regular), WordPress calls get_default_post_to_edit which then sets the default values a new post will have. This function provides a few filter hooks for changing the default title, content and excerpt, but unfortunately nothing else... however each filter passes along the complete $post object to the callback, ...


9

you can use comment_unapproved_to_approved action hook to call your function which will use a commentmeta field to count how many times that comment has been approved or by how many users and if it's less then 3 then we updated the comment to not approved : update I'm posting an updated code in the form of a plugin which fixes a few typos: <?php /* ...


8

From what I understand, you want to set pages and some custom post types to have commenting 'off' by default, while posts will still use the default option (i.e. commenting 'on'). If this is the case, the following function will do it. function default_comments_off( $data ) { if( $data['post_type'] == 'page' && $data['post_status'] == ...


8

Actually, it is not that hard. The last access time for a user is in get_user_meta( get_current_user_id(), 'last_access', TRUE ). The date of each comment is in the column comment_date. Both share the same format, so we can compare them in SQL with a simple >. There is an action in the Right Now dashboard widget to show additional rows: ...


7

Create a file in wp-content/plugins/ with this code: <?php /* Plugin Name: Get Rid of Comment Websites */ function my_custom_comment_fields( $fields ){ if(isset($fields['url'])) unset($fields['url']); return $fields; } add_filter( 'comment_form_default_fields', 'my_custom_comment_fields' ); Normally, I'd say put it into your theme's ...


7

comment_karma This field is used by a few plug-ins to help you manage your comments. There are a few good articles explaining its exact use floating around on the Internet. But you should note that this field is actually just not used. As Mark Jaquith said once, it's a "there if you want to use it this." There was a short movement to remove it for ...


7

First of all, I highly recommend using the comment_form() function. It's all of the above code in one line (more if you need to tweak parts of the code). You can designate name and email as required in the settings section of your admin area:


7

Alternative for people reading this with a fear for SQL............... (or finding this via Google after Januari 2011): Wait for this action until 3.1 comes out, then go to a post, check all comments and bulk "move to trash" :) (it should come out any day now) (http://wordpress.org/about/roadmap/) (or download 3.1 RC3 from ...


7

Hi @Shaun: Great question! WordPress assigns your comment page number to the query var 'cpage' which gets set when your URL has /comment-page-1/ at the end. So your culprit is in the redirect_canonical() function, line 192 of /wp-includes/canoncial.php. if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) { Since the ...


7

To record the moderator that approves the comment: function wpse_comment_moderator_log( $comment ) { global $current_user; get_currentuserinfo(); update_comment_meta( $comment->comment_ID, 'approved_by', $current_user->user_login ); } add_action( 'comment_unapproved_to_approved', 'wpse_comment_moderator_log' ); To display it after the ...


7

That's pretty simple. You just have to take the textarea out of the default fields – filter 'comment_form_defaults' – and print it on the action 'comment_form_top': <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Comment Textarea On Top * Description: Makes the textarea the first field of the comment form. * Version: 2012.04.30 * Author: ...


7

Either of these 3 will help you: //Before getting the comments, on the WP_Comment_Query object for each comment add_action('pre_get_comments', 'wpse56652_filt_comm'); //Applied on the comments SQL Query, you can modify the 'Where' part of the query add_filter('comments_clauses', 'wpse56652_filt_comm'); //After the comments are fetched, you can modify the ...


7

I'm working with the Foundation framework as well. I've found that the easiest way to add a class to a non-filterable element is to do it with jQuery. jQuery(document).ready(function($) { //noconflict wrapper $('input#submit').addClass('button'); });//end noconflict


6

You should filter 'comment_form_default_fields' to add the placeholder attribute. Sample code add_filter( 'comment_form_default_fields', 'wpse_62742_comment_placeholders' ); /** * Change default fields, add placeholder and change type attributes. * * @param array $fields * @return array */ function wpse_62742_comment_placeholders( $fields ) { ...


6

There are two ways to customize the default avatar: Add a new default avatar to Settings/Discussion. Change the output of get_avatar(). Let’s start with the first option; this processes slightly faster. Add a new default avatar to Settings/Discussion There is a filter 'avatar_defaults'. You can add more avatars here. You get an array of default images ...


6

Just like posts, a comment can have an array of different statuses, so instead of naming a hook with each status, they have transition hooks, which tell you what status it had before and what's the new status. In your case, this might do the trick: add_action('transition_comment_status', 'my_approve_comment_callback', 10, 3); function ...


6

Per default wp_list_comments() calls the class Walker_Comment. Its method start_el() calls edit_comment_link() and here we find a filter for your question: It is called 'edit_comment_link' and it passes two variables, the link text and the comment ID, which we can use. The URLs to mark a comment as spam or to delete it are: ...


6

There are a couple other hooks in the comment form that you can use. Where you're hooking on only displays if the user isn't logged in. If you want that field for all users (logged in or not), you need to add your form by hooking into both comment_form_after_fields and comment_form_logged_in_after, both of which are actions, and echo out the new field. ...


6

Ok - so I solved this. Here is what appears to be the problem. Comments are disabled by default for custom-post-types. This happens even if you have them enabled in the overall settings To fix it, all I had to do was the following: In SETTINGS > DISCUSSION uncheck the "Allow people to post comments on new articles" setting. Click "Save Changes" Now go ...


6

You really don’t need much. A headline with id=comments <h2 id="comments"><?php comments_number(); ?></h2> This will be the target for comments_link() in the article loop. Links for paginated comments. Usually, I put these links into a function and call the function above and below the comments list: class TTT_Template { function ...


6

Its most likely to be a TrackBack or pingback: In a nutshell, TrackBack was designed to provide a method of notification between websites: it is a method of person A saying to person B, "This is something you may be interested in." To do that, person A sends a TrackBack ping to person B.



Only top voted, non community-wiki answers of a minimum length are eligible