Changeset 1316
- Timestamp:
- 08/29/08 06:40:46 (3 months ago)
- Files:
-
- bb-topic-views/trunk/bb-topic-views.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bb-topic-views/trunk/bb-topic-views.php
r1312 r1316 1 1 <?php 2 2 /* 3 Plugin Name: bb -Topic-Views3 Plugin Name: bb Topic Views 4 4 Plugin URI: http://bbpress.org/plugins/topic/bb-topic-views/ 5 5 Description: Counts the number of times a topic has been viewed, and allows the administrator to display the count in various places. 6 6 Author: Mike Wittmann, _ck_ 7 7 Author URI: http://blog.wittmania.com/ 8 Version: 1.6. 08 Version: 1.6.1 9 9 */ 10 10 … … 107 107 global $bbdb, $topic, $topic_id; 108 108 109 if (is_topic()) { 109 if (is_topic()) { 110 if (empty($topic_id)) {if (empty($topic)) {return;} else {$topic_id=$topic->topic_id;}} // should never happen in bb_head but does for some reason in 1.0 ? 111 110 112 if (empty($topic->views)) {$view_count=0;} else {$view_count=$topic->views;} 111 113 112 114 if ($view_count>=1) { 113 115 … … 120 122 if (bb_get_option('bb_db_version')>1600) { // bbPress 1.0 121 123 122 @$bbdb->query("UPDATE $bbdb->meta SET meta_value=meta_value+1 WHERE object_type ='bb_topic' AND object_id=$topic_id AND meta_key='views' LIMIT 1");124 @$bbdb->query("UPDATE $bbdb->meta SET meta_value=meta_value+1 WHERE object_type = 'bb_topic' AND object_id = $topic_id AND meta_key='views' LIMIT 1"); 123 125 124 126 } else { // 0.7 - 0.9 125 127 126 @$bbdb->query("UPDATE $bbdb->topicmeta SET meta_value=meta_value+1 WHERE topic_id =$topic_id AND meta_key='views' LIMIT 1");128 @$bbdb->query("UPDATE $bbdb->topicmeta SET meta_value=meta_value+1 WHERE topic_id = $topic_id AND meta_key='views' LIMIT 1"); 127 129 128 130 }
