Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

We have started with a lot of users who writes articles for the site. We want now rate every article internally for haveing an overview of the users with the best articles. Does someone know a plugin to rate articles internally, so they will not show up on the site, only in the dashboard of WP.

Thanks,

Tom

share|improve this question
1  
Why not use a simple custom field??? –  Bainternet Apr 9 '12 at 14:55

3 Answers 3

My solution to this question would be to add a custom field / metabox to all of your posts where you can select a desired rating from a drop down menu.

I would also then add the internal rating that you assign to post within the posts list screen so you can see at a glance each posts rating instead of having to click "edit" to see whether a post has a rating or not. If a post has no rating then it will list "Not rated".

I in fact do something very similar on one of my sites and here's some basic code that will help you achieve that...

Here are the two simple steps.

1) Paste the following into your functions.php file which will create a drop down custom field called Internal Rating (NOTE you can change the values of your drop down menu to suit your purpose, be it descriptive words like in my example or a number based rating);

add_action( 'add_meta_boxes', 'add_internal_rating' );    

function add_internal_rating() {

    add_meta_box('wpt_internal_rating', 'Internal Rating', 'wpt_internal_rating', 'post', 'normal', 'high');
}
// The Internal Rating Metabox 
function wpt_internal_rating() {
    global $post;
    echo '<input type="hidden" name="ratingtmeta_noncename" id="ratingmeta_noncename" value="' .
    wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
    $location = get_post_meta($post->ID, '_rating', true);
    echo '<select name="_rating">
    <option value="good" ' . (selected( $location , 'good', true)) . '>Good</option>
    <option value="bad" ' . (selected( $location , 'bad', true)) . '>Bad</option>
    <option value="ugly" ' . (selected( $location , 'ugly', true)) . '>Ugly</option>
    </select>';
    }
// Save the Metabox Data
function wpt_save_ratings_meta($post_id, $post) {

    if ( !wp_verify_nonce( $_POST['ratingmeta_noncename'], plugin_basename(__FILE__) )) {
    return $post->ID;
    }

    if ( !current_user_can( 'edit_post', $post->ID ))
        return $post->ID;

    $ratings_meta['_rating'] = $_POST['_rating'];

    foreach ($ratings_meta as $key => $value) { 
        if( $post->post_type == 'revision' ) return; 
        $value = implode(',', (array)$value); 
        if(get_post_meta($post->ID, $key, FALSE)) { 
            update_post_meta($post->ID, $key, $value);
        } else { 
            add_post_meta($post->ID, $key, $value);
        }
        if(!$value) delete_post_meta($post->ID, $key); 
    }
}
add_action('save_post', 'wpt_save_ratings_meta', 1, 2);

2) Next you want to add the following code to your functions.php file also, which will show the Rating post column on your Posts list screen;

    if ( !function_exists('internal_rating_column') ) {

        function internal_rating_column($cols) {
        $cols['rating'] = __('Rating');
        return $cols;
        }

        function internal_rating_value($column_name, $post_id) {

        if ( 'rating' == $column_name ) {

        $rating = get_post_meta( $post_id, '_rating', true );

            echo $rating;
            } else {
            echo __('Not rated');
            }
        }
    }

    add_filter( 'manage_posts_columns', 'internal_rating_column' );
    add_action( 'manage_posts_custom_column', 'internal_rating_value', 10, 2 );

The great thing about using a custom field to solve this issue is that you can query the data held within your Internal Rating field not only in the back end but also in the front end and although you don't have a need for it right now, you may in the future wish to query that value somewhere in your front end theme. That ability is there, if the need ever arises.

share|improve this answer

You could use PollDaddy ratings and just display it to logged in editors, authors, etc.

<?php
    if ( current_user_can( 'manage_options' ) {
        echo polldaddy_get_rating_html();
    }
?>

And if you want to do that only on the admin side you'll want to create a meta box to display on the post edit screen which you can learn how to do here: add_meta_box()

share|improve this answer

You have several options but I think a good and easy solution for you would be to add a custom taxonomy.

In functions.php, add this code:

add_action( 'init', 'init_register', 0 );

function init_register()
{
register_taxonomy('admincategory','post', array(
'labels' => array(
    'name' => 'Admincategories',
    'singular_name' => 'Admincategory',
    'add_new' => 'Add new',
    'add_new_item' => 'Add new Admincategory',
    'edit_item' => 'Edit Admincategory',
    'new_item' => 'New Admincategory',
    'view_item' => 'Show Admincategory'
 ),
 'public' => false,
 'show_ui' => true,
 'hierarchical' => true,  // this can be removed if you like that better, see more options on http://codex.wordpress.org/Function_Reference/register_taxonomy
));
}

Then you have what you need but this is better than just a linear rating. You'll be flexible and can find a lot of new ways to use this functionality.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.