Changeset 364169
- Timestamp:
- 03/24/2011 12:42:36 PM (15 years ago)
- Location:
- rockhoist-badges
- Files:
-
- 6 added
- 2 edited
-
tags/1.2 (added)
-
tags/1.2/readme.txt (added)
-
tags/1.2/rh-badges.php (added)
-
tags/1.2/screenshot-1.png (added)
-
tags/1.2/screenshot-2.png (added)
-
tags/1.2/screenshot-3.png (added)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/rh-badges.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rockhoist-badges/trunk/readme.txt
r362888 r364169 5 5 Requires at least: 3.1 6 6 Tested up to: 3.1 7 Stable tag: 1. 17 Stable tag: 1.2 8 8 9 9 A Stack Overflow inspired plugin for WordPress which allows users to acquire badges for contributing website content. … … 12 12 13 13 A Stack Overflow inspired plugin for WordPress which allows users to acquire badges for contributing website content. Badges are created and managed through the WordPress Dashboard. 14 15 Key features include: 16 17 * Administration page to manage badges and conditions 18 * A widget to display recently awarded badges 19 * Function which generates a table of badges 20 * Manually award and revoke badges 21 * Automatically check/ award badges after publishing posts/ comments 22 23 Contact me if you find any bugs, issues or have a feature request and I will do my best to accommodate. 24 25 More examples and information @ [blarrr.com](http://blarrr.com/wordpress-badges-plugin/) 14 26 15 27 == Installation == … … 27 39 == Changelog == 28 40 41 = 1.2 = 42 * Added user ID to the filter in both `rhb_list_badges()` and `rhb_get_badges()`. 43 29 44 = 1.1 = 30 45 * Added 'Latest Badges' widget. … … 34 49 * First release. 35 50 36 == Features ==37 38 * Create and edit custom badges and badge conditions.39 * Manually award/ revoke badges.40 * Automatically check badge conditions and award badges after user creates a new post.41 * Dashboard administration.42 43 51 == Limitations == 44 52 45 53 * Does not support OR conditions or nested conditions. 46 54 * The current version only supports limited object types: post_tag, post_count and comment_count. 47 * Conditions cannot be restricted by post type or category (without modifying plugin code). 48 49 50 For more info, visit [blarrr](http://blarrr.com/wordpress-badges-plugin/). 55 * Conditions cannot be restricted by post type or category without modifying plugin code. -
rockhoist-badges/trunk/rh-badges.php
r362839 r364169 2 2 /* 3 3 Plugin Name: Rockhoist Badges 4 Version: 1. 14 Version: 1.2 5 5 Plugin URI: http://blarrr.com/wordpress-badges-plugin/ 6 6 Description: A Stack Overflow inspired plugin which allows users to acquire badges. Badges are created and managed through the standard WordPress Dashboard. … … 29 29 30 30 // Change Log 31 $current_version = array('1. 1');31 $current_version = array('1.2'); 32 32 33 33 // Database schema version … … 140 140 if ( empty($filter ) ) { $filter = array(); } 141 141 142 $sql = 'SELECT badge_id, name, description, type FROM ' . $wpdb->prefix . 'rh_badges'; 143 142 // Select all rows by default 143 $sql = 'SELECT badge_id, name, description, type FROM ' . $wpdb->prefix . 'rh_badges b WHERE 1=1'; 144 145 // If a user ID was entered. 146 if ( array_key_exists('user_ID', $filter) ) { 147 148 $user_ID = $filter['user_ID']; 149 150 // Join the rh_user_badges table. 151 $sql = 'SELECT b.badge_id, b.name, b.description, b.type 152 FROM ' . $wpdb->prefix . 'rh_badges b, 153 ' . $wpdb->prefix . 'rh_user_badges ub 154 WHERE b.badge_id = ub.badge_id 155 AND ub.user_id = ' . $user_ID; 156 157 } 158 144 159 // If a badge ID was entered. 145 if ( array_key_exists('badge_ID', $filter)) {160 if ( array_key_exists('badge_ID', $filter) ) { 146 161 147 162 $badge_ID = $filter['badge_ID']; 148 163 149 164 // Append a WHERE clause to the SQL. 150 $sql .= " WHEREbadge_id = $badge_ID";165 $sql .= " AND b.badge_id = $badge_ID"; 151 166 } 152 167 … … 156 171 } 157 172 158 function rhb_list_badges() { 173 function rhb_list_badges( $filter = '' ) { 174 175 176 if ( empty($filter ) ) { $filter = array(); } 159 177 160 178 print '<div id="badge-table"> 161 179 <table> 162 180 <tbody>'; 163 164 foreach (rhb_get_badges( ) as $badge) {181 182 foreach (rhb_get_badges( $filter ) as $badge) { 165 183 166 184 print '<tr>
Note: See TracChangeset
for help on using the changeset viewer.