humanmade / comment-popularity

Allow visitors to vote on comments
MIT License
25 stars 15 forks source link

Comment Popularity

Contributors: pauldewouters,mattheu,humanmade,cfo-publishing
Tags: comments,vote,upvote,karma,widget
Requires at least: 4.9
Tested up to: 4.9.3
Stable tag: 1.5
Requires PHP: 5.3.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Comment Popularity adds the ability for visitors to vote on comments.

Description

With this plugin, members of your site will be able to vote comments up or down. Think Reddit comments.

After activating the plugin, there will be up/down arrows next to each comment and the total weight of the comment. Comments are sorted by weight in a descending order.

Each commenter is allocated karma each time that one of their comments are upvoted.

Admin users can give users the "expert" label which will attribute more weight to their comments.

You'll find an option under discussion for the default expert karma and it can also be changed on the user's profile.

Follow development of this plugin on Github

Requires PHP 5.3.2 or newer.

Installation

Using The WordPress Dashboard

  1. Navigate to the 'Add New' in the plugins dashboard
  2. Search for 'plugin-name'
  3. Click 'Install Now'
  4. Activate the plugin on the Plugin dashboard

Uploading in WordPress Dashboard

  1. Navigate to the 'Add New' in the plugins dashboard
  2. Navigate to the 'Upload' area
  3. Select plugin-name.zip from your computer
  4. Click 'Install Now'
  5. Activate the plugin in the Plugin dashboard

Using FTP

  1. Download plugin-name.zip
  2. Extract the plugin-name directory to your computer
  3. Upload the plugin-name directory to the /wp-content/plugins/ directory
  4. Activate the plugin in the Plugin dashboard

Frequently Asked Questions

Can anonymous visitors vote on comments?

Yes, you can enable guest voting by adding this snippet to a mu-plugin: add_filter( 'hmn_cp_allow_guest_voting', '__return_true' );

Please note that it uses cookies and IP addresses to identify a visitor. This is not as reliable as requiring a user to create an account. Cookies can be deleted, and IP addresses can be shared.

Can comment weight be negative?

Yes, you can enable negative weight by adding this snippet to a mu-plugin: add_filter( 'hmn_cp_allow_negative_comment_weight', '__return_true' );

Can I disable the sorting by comment weight?

Yes, add this snippet to your functions.php file or mu plugin: add_filter( 'hmn_cp_sort_comments_by_weight', '__return_false' );

Where do I find the plugin settings?

Under Settings > Discussion, and Users > Profile

Advanced Usage

I want to use this with a custom comment template.

First thing - you need to remove the default comments template added by the plugin.

add_action( 'plugins_loaded', function() { remove_filter( 'comments_template', array( 'HMN_Comment_Popularity', 'custom_comments_template' ) ); }, 100 );

Secondly, you need to add replace the wp_list_comments call with the following code:

if ( function_exists( 'hmn_cp_the_sorted_comments' ) ) { hmn_cp_the_sorted_comments( $args ); } else { wp_list_comments(); }

Finally, you need to add the following function to your custom comment template where you would like to output the voting icons.

hmn_cp_the_comment_upvote_form();

To display the comment author karma:

hmn_cp_the_comment_author_karma();

Screenshots

1. Set the default karma value for expert users.

Set the default karma value for expert users.

2. Set the user's karma and expert label.

Set the user's karma and expert label.

3. The comment voting controls, and the user's karma on the public facing site.

The comment voting controls, and the user's karma on the public facing site.

Upgrade Notice

1.3.0

1.2.1

1.2.0

1.1.2

Changelog

1.5

1.4.3.3

1.4.3.2

1.4.3.1

1.4.3

1.4.2

1.4.1

1.4.0 / 2016-04-15

1.3.4 / 2015-02-12

1.3.3 / 2014-10-25

1.3.2 / 2014-10-10

1.3.1 / 2014-09-11

1.3.0 / 2014-09-01

1.2.1 / 2014-08-27

1.2.0 / 2014-08-24

1.1.5 / 2014-08-19

1.1.4 / 2014-08-18

1.1.3 / 2014-08-16

1.1.2 / 2014-08-15

1.1.1 / 2014-08-13

1.1.0 / 2014-08-13

1.0.2 / 2014-08-08

1.0.1

1.0.0