WordPress.org

Plugin Directory

Changeset 482847


Ignore:
Timestamp:
12/31/11 19:24:45 (2 years ago)
Author:
goldenapples
Message:

Fixed some documentation in readme file

Location:
recommended-links
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • recommended-links/tags/0.2.3/readme.txt

    r481905 r482847  
    1111== Description == 
    1212 
    13 This is the beginnings of a much more ambitious project. At the moment, there is no admin options screen and functionality is a bit limited. However, if you want to try this out, please give me feedback.  
     13This is the beginnings of a much more ambitious project. At the moment, there is no admin options screen and functionality is a bit limited. However, if you want to try this out, please give me feedback. 
    1414 
    1515I will guarantee backwards compatibility with all data saved by the plugin, so it should be safe to install and activate, and as I add features, your existing posts and links will work with them just fine. 
     
    19191. Upload the entire `recommended-links/` folder to the `/wp-content/plugins/` directory 
    20201. Activate the plugin through the 'Plugins' menu in WordPress 
    21 1. Include the 'Reclinks Add Link Form' in a sidebar (or anywhere). 
    22 1. Any links added through this plugin show up in the archive for post type "Recommended Links". If you have permalinks enabled, that will be displayed at `http://yoursite.tld/reclinks`; otherwise it will be at `http://yoursite.com?post_type=reclinks` 
     211. Include the 'Reclinks Add Link Form' widget in a sidebar (or anywhere). 
     221. Any links added through this widget show up in the archive for the custom post type "Recommended Links".  
     231. If you have permalinks enabled, the archive will be displayed at `http://yoursite.tld/reclinks`; otherwise it will be at `http://yoursite.tld?post_type=reclink`. __(Note: on first activating the plugin, you may have to "flush your rewrite rules" to make these permalinks work - this can be done by visiting the Settings » Permalinks page in your WordPress admin once.)__ 
    23241. The plugin tries to intelligently filter markup so that it can work with most themes out of the box. If the archive or single link display doesn't work in your theme, you may have to create an `archive-reclink.php` or `single-reclink.php` template file. _(See the FAQ for examples of markup for these template files)_. 
    2425 
     
    3435* **score** Sort by total vote score over time 
    3536 
    36 So for example, the URL `yoursite.tld/reclinks/?sort=hot` would display a page of the 25 links with the highest vote score over the past day. 
     37So for example, with permalinks enabled, the URL `yoursite.tld/reclinks/?sort=hot` would display a page of the 25 links with the highest vote score over the past day. 
    3738 
    3839At this point, implementing these sorting options is fully up to you - a user cookie would make sense here, or a drop down at the top of the archive page would work. I will provide a template tag and a widget to change sorting once I flesh out these options some more. 
  • recommended-links/trunk/readme.txt

    r481905 r482847  
    1111== Description == 
    1212 
    13 This is the beginnings of a much more ambitious project. At the moment, there is no admin options screen and functionality is a bit limited. However, if you want to try this out, please give me feedback.  
     13This is the beginnings of a much more ambitious project. At the moment, there is no admin options screen and functionality is a bit limited. However, if you want to try this out, please give me feedback. 
    1414 
    1515I will guarantee backwards compatibility with all data saved by the plugin, so it should be safe to install and activate, and as I add features, your existing posts and links will work with them just fine. 
     
    19191. Upload the entire `recommended-links/` folder to the `/wp-content/plugins/` directory 
    20201. Activate the plugin through the 'Plugins' menu in WordPress 
    21 1. Include the 'Reclinks Add Link Form' in a sidebar (or anywhere). 
    22 1. Any links added through this plugin show up in the archive for post type "Recommended Links". If you have permalinks enabled, that will be displayed at `http://yoursite.tld/reclinks`; otherwise it will be at `http://yoursite.com?post_type=reclinks` 
     211. Include the 'Reclinks Add Link Form' widget in a sidebar (or anywhere). 
     221. Any links added through this widget show up in the archive for the custom post type "Recommended Links".  
     231. If you have permalinks enabled, the archive will be displayed at `http://yoursite.tld/reclinks`; otherwise it will be at `http://yoursite.tld?post_type=reclink`. __(Note: on first activating the plugin, you may have to "flush your rewrite rules" to make these permalinks work - this can be done by visiting the Settings » Permalinks page in your WordPress admin once.)__ 
    23241. The plugin tries to intelligently filter markup so that it can work with most themes out of the box. If the archive or single link display doesn't work in your theme, you may have to create an `archive-reclink.php` or `single-reclink.php` template file. _(See the FAQ for examples of markup for these template files)_. 
    2425 
     
    3435* **score** Sort by total vote score over time 
    3536 
    36 So for example, the URL `yoursite.tld/reclinks/?sort=hot` would display a page of the 25 links with the highest vote score over the past day. 
     37So for example, with permalinks enabled, the URL `yoursite.tld/reclinks/?sort=hot` would display a page of the 25 links with the highest vote score over the past day. 
    3738 
    3839At this point, implementing these sorting options is fully up to you - a user cookie would make sense here, or a drop down at the top of the archive page would work. I will provide a template tag and a widget to change sorting once I flesh out these options some more. 
  • recommended-links/trunk/recommended-links.php

    r481905 r482847  
    2121if ( isset( $plugin ) ) 
    2222    define( 'RECLINKS_DIRECTORY', plugin_dir_url( $plugin ) ); 
    23 else define( 'RECLINKS_DIRECTORY', RECLINKS_DIRECTORY ); 
     23else define( 'RECLINKS_DIRECTORY', plugin_dir_url( __FILE__ ) ); 
    2424 
    2525// Required files 
     
    199199    } 
    200200 
     201    do_action( 'reclink_add_vote', $reclink, $comment, $vote ); 
     202 
    201203    return $new_vote_total + 1; 
    202204} 
  • recommended-links/trunk/user-functions.php

    r481240 r482847  
    4040    } 
    4141} 
     42 
     43add_action( 'reclink_add_vote', 'update_author_karma', 10, 2); 
     44 
     45/** 
     46 * After a vote is placed, update the post or comment author's total karma score. 
     47 * Recounts votes from all posts and comments that author has written... 
     48 * Could grow to be bad for performance, but in initial tests (scores < 5000) 
     49 * it seemed acceptable... 
     50 * 
     51 * @param   int     post ID of link voted on 
     52 * @param   int     comment ID (null/zero if vote was on post) 
     53 * @return  none 
     54 */ 
     55function update_author_karma( $post, $comment ) { 
     56    $author = ( $comment ) ?  @get_comment( $comment )->user_id : @get_post( $post )->post_author; 
     57    if ( !$author ) return; 
     58    $new_karma = 0; 
     59 
     60    $author_posts = get_posts( array( 'post_type' => 'reclink', 'author' => $author, 'numberposts' => -1 ) ); 
     61    foreach ( $author_posts as $p ) 
     62        $new_karma += get_post_meta( $p->ID, '_vote_score', true ); 
     63     
     64    $author_comments = get_comments( array( 'user_id' => $author ) ); 
     65    foreach ( $author_comments as $c ) 
     66        $new_karma += $c->comment_karma; 
     67     
     68    $new_karma = apply_filters( 'author_karma', $new_karma ); 
     69    update_user_meta( $author, '_author_karma', $new_karma ); 
     70} 
     71 
     72/** 
     73 * Retrieve a user's comment score. 
     74 * 
     75 * @param   int|object  User ID, or the entire WP_User object 
     76 * @return  int         the author's karma score 
     77 */ 
     78function author_karma( $user ) { 
     79    if ( is_object( $user ) ) 
     80        $user = $user->ID; 
     81    $karma = get_user_meta( $user, '_author_karma', true ); 
     82    return $karma; 
     83} 
Note: See TracChangeset for help on using the changeset viewer.