描述
TK bbPress Stats provides useful statistics about your bbPress forum with modern security and performance features. Fully compatible with PHP 8.5 while maintaining backward compatibility to PHP 7.4.
Key Features:
- Display forum statistics in widgets or via shortcode
- Intelligent caching for optimal performance
- Secure database queries with prepared statements
- Full internationalization support
- Modern PHP 8.5 code with type safety
- Conditional asset loading for better performance
Available Statistics:
- 总计用户
- Total Topics
- Total Replies
- Total Posts (topics + replies)
- Total Forums
Each statistic can be individually enabled/disabled, and the widget title is fully customizable.
Security Features:
- SQL injection protection with prepared statements
- XSS prevention with proper output escaping
- Input sanitization on all user data
- Capability checks for admin access
- Path traversal protection
Performance Optimizations:
- Smart caching (1-hour default, auto-invalidates on changes)
- Conditional script/style loading
- Optimized database queries
- Minimal resource footprint
安装
Automatic Installation
- Log in to your WordPress admin panel
- Navigate to Plugins > Add New
- Search for “TK bbPress Stats”
- Click “Install Now” and then “Activate”
Manual Installation
- Download the plugin zip file
- Upload the folder
tk-bbpress-statsto the/wp-content/plugins/directory - Activate the plugin through the ‘Plugins’ menu in WordPress
- Configure the widget in Appearance > Widgets or use the shortcode
Widget Usage
- Go to Appearance > Widgets
- Drag “TK bbPress Stats” to your desired widget area
- Configure which statistics to display
- Save your settings
Shortcode Usage
Insert this shortcode in any post or page:
[widget widget_name=”TK_bbPress_Stats”]
Then configure display options in Settings > TK bbPress Stats
Requirements
- WordPress 5.0 or higher
- bbPress plugin installed and activated
- PHP 7.4 or higher (PHP 8.0+ recommended)
常见问题
-
What statistics can this widget display?
-
The widget can show:
* Total Users
* Total Topics
* Total Replies
* Total Posts (topics + replies combined)
* Total ForumsEach statistic can be individually enabled or disabled.
-
Does the widget count unpublished or trashed content?
-
No, only published topics, replies, and forums are counted.
-
Is this plugin compatible with PHP 8.5?
-
Yes! Version 2.0.0 is fully compatible with PHP 8.5 while maintaining backward compatibility with PHP 7.4+.
-
How does caching work?
-
Statistics are cached for 1 hour by default. The cache automatically clears when:
* A new topic is created
* A new reply is posted
* A new forum is created
* A user registers or is deleted -
Is this plugin secure?
-
Yes, version 2.0.0 includes comprehensive security improvements:
* SQL injection protection with prepared statements
* XSS prevention with proper escaping
* Input sanitization
* Capability checks
* Path traversal protection -
Will upgrading from v1.x break my site?
-
No, version 2.0.0 is fully backward compatible. Your existing settings and widget configurations will be preserved.
-
Can I customize the cache duration?
-
Yes, add this to your wp-config.php:
define(‘TK_BBPRESS_STATS_CACHE_EXPIRATION’, 3600); // seconds -
Does this work with multisite?
-
Yes, the plugin works with WordPress multisite installations.
-
How do I translate this plugin?
-
The plugin is fully internationalized. Use a translation plugin like Loco Translate or create .po/.mo files in the /lang directory.
评价
此插件暂无评价。
贡献者及开发者
更新日志
2.0.0 – 2026-01-26
Major Security & Modernization Release
- SECURITY: Fixed SQL injection vulnerability in database queries
- SECURITY: Added input sanitization for all user inputs
- SECURITY: Implemented capability checks for admin access
- SECURITY: Added path validation for file includes
- SECURITY: Proper output escaping throughout
- NEW: PHP 8.5 compatibility with type declarations
- NEW: Intelligent caching system (1-hour default)
- NEW: Conditional asset loading for better performance
- NEW: Full internationalization support
- NEW: bbPress dependency check on activation
- IMPROVED: Modern PHP syntax (short arrays, typed properties)
- IMPROVED: Optimized database queries with prepared statements
- IMPROVED: Better error handling and user feedback
- IMPROVED: Code organization and documentation
- IMPROVED: Widget configuration interface
- FIXED: Deprecated widget constructor
- FIXED: Undefined array key warnings
- FIXED: Inconsistent option naming
- Minimum PHP version: 7.4 (backward compatible)
- Minimum WordPress version: 5.0
- Tested up to WordPress 6.7
1.0.3 – 2016-03-27
- Added shortcode option for putting widget inside posts/pages
1.0.2 – 2016-03-26
- Small code cleanup
- Added screenshots, icon and header image
1.0.1 – 2016-03-25
- Small code cleanup
- Image updates
1.0.0 – 2016-03-20
- Initial release


