Add bbPress Support Toolkit plugin files

Initial commit of the bbPress Support Toolkit plugin, including main plugin file, admin settings, core functionality, widgets, styles, and language files. This provides support forum enhancements such as topic status management, user ranking, premium forum options, and various admin and SEO settings.
This commit is contained in:
feibisi 2025-07-23 19:45:30 +08:00
parent b8484bf876
commit 541ff64fbe
8 changed files with 6566 additions and 0 deletions

374
assets/style.css Executable file
View file

@ -0,0 +1,374 @@
.resolved {
color: green;
}
.urgent {
color: red;
}
.claimed {
color: #efbf1c;
}
.bbps-support-forums-message {
clear: left;
float: left;
display: block;
width: 600px;
font-size: 14px;
margin-bottom: 15px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 6px;
background-color: #f9f9f9;
}
#bbps_support_forum_options {
margin-bottom: 15px;
}
#bbps-topic-move {
margin-bottom: 10px;
}
.med-text {
width: 80px;
}
.bbps-clear {
clear: both;
}
.bbps_float_left {
float: left;
width: 100px;
}
.topic_stat {
float: left;
width: 100px;
}
.clear {
clear: both;
}
.float_right {
float: right;
margin-right: 10px;
}
.bbps-links {
margin-right: 3px;
}
td.bbp-topic-author,
td.bbp-reply-author {
display: block;
width: 106px;
}
#bbps-user-title {
font-style: italic;
font-size: 12px;
color: #666;
margin-top: 5px;
}
#bbps-post-count {
font-size: 11px;
color: #999;
margin-top: 3px;
}
#trusted {
color: #0073aa;
font-size: 11px;
margin-top: 3px;
}
.label {
display: inline-block;
padding: 4px 6px;
font-size: 12px;
font-weight: normal;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 4px;
margin-right: 5px;
}
.label-success {
background-color: #73B73E;
}
.label-warning {
background-color: #db3b37;
}
.label-info {
background-color: #5bc0de;
}
.label-secondary {
background-color: #9e9e9e;
}
.label-new {
background-color: #f46d6a;
}
.label-closed {
background-color: #dcdcdc;
}
.label-sticky {
background-color: #f7ab60;
}
.post-starter-label {
display: inline-block;
font-size: 11px;
font-weight: normal;
line-height: 1;
color: #fff;
border-radius: 3px;
margin-top: 3px;
background-color: #f7ab60;
padding: 5px 6px;
}
.bbps-private-reply {
background: rgba(255, 255, 255, 0.5) !important;
border-left: 4px solid #ffc107;
}
.bbps-private-reply .bbp-reply-content:before {
content: "🔒";
display: inline-block;
margin-right: 5px;
color: #ffc107;
font-weight: bold;
}
.bbps-private-reply .bbp-reply-content {
position: relative;
padding-left: 25px;
}
.badge {
display: inline-block;
min-width: 10px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 10px;
margin-left: 5px;
}
.badge-info {
background-color: #5bc0de;
}
.well {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
text-decoration: none;
}
.btn-primary {
color: #fff;
background-color: #337ab7;
border-color: #2e6da4;
}
.btn-primary:hover {
color: #fff;
background-color: #286090;
border-color: #204d74;
}
.btn-default {
color: #333;
background-color: #fff;
border-color: #ccc;
}
.btn-default:hover {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.alert-error {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.form-control {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
transition:
border-color ease-in-out 0.15s,
box-shadow ease-in-out 0.15s;
}
.form-group {
margin-bottom: 15px;
}
.input-group {
position: relative;
display: table;
border-collapse: separate;
}
.input-group .form-control {
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0;
}
.input-group-addon {
padding: 6px 12px;
font-size: 14px;
font-weight: normal;
line-height: 1;
color: #555;
text-align: center;
background-color: #eee;
border: 1px solid #ccc;
border-radius: 4px;
width: 1%;
white-space: nowrap;
vertical-align: middle;
display: table-cell;
}
.forum_text {
font-weight: bold;
margin-bottom: 10px;
display: block;
}
.green {
color: #5cb85c;
}
.red {
color: #d9534f;
}
.forum_hours {
font-size: 12px;
color: #666;
margin-top: 5px;
}
#supportwrapper {
text-align: center;
}
#html_clock {
margin-top: 15px;
}
.bbps-support-forums-message {
background-color: #fff3cd;
border-color: #ffeaa7;
color: #856404;
padding: 12px 15px;
margin: 10px 0;
border: 1px solid transparent;
border-radius: 8px;
font-size: 12px;
width: 100%;
float: none;
clear: both;
box-sizing: border-box;
}
.bbps-support-forums-message a {
color: #856404;
font-weight: bold;
text-decoration: underline;
}
.bbps-support-forums-message a:hover {
text-decoration: none;
}
.bbps-support-forums-message strong {
font-weight: 600;
color: #664d03;
}
.column-bbps_status {
width: 80px;
}
.column-bbps_forum {
width: 100px;
}

224
bbpress-support-toolkit.php Executable file
View file

@ -0,0 +1,224 @@
<?php
/*
Plugin Name: bbPress Support Toolkit
Plugin URI: https://cyberforums.com/bbpress-support-toolkit
Author: Cyberforums.com
Author URI: https://cyberforums.com
Description: Transform your bbPress forums into comprehensive support forums with status management, user ranking, and premium features
Version: 1.1.0
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: bbpress-support-toolkit
Domain Path: /languages
*/
if (!defined("ABSPATH")) {
exit();
}
final class BBPress_Support_Toolkit
{
private static $instance = null;
public static function instance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
private function __construct()
{
$this->define_constants();
$this->init_hooks();
$this->includes();
}
private function define_constants()
{
define("BBPS_VERSION", "1.1.0");
define("BBPS_PLUGIN_FILE", __FILE__);
define("BBPS_PLUGIN_PATH", plugin_dir_path(__FILE__));
define("BBPS_PLUGIN_URL", plugin_dir_url(__FILE__));
define("BBPS_INCLUDES_PATH", BBPS_PLUGIN_PATH . "includes/");
define("BBPS_ASSETS_PATH", BBPS_PLUGIN_PATH . "assets/");
define("BBPS_ASSETS_URL", BBPS_PLUGIN_URL . "assets/");
}
private function init_hooks()
{
register_activation_hook(__FILE__, [$this, "activate"]);
register_uninstall_hook(__FILE__, ["BBPress_Support_Toolkit", "uninstall"]);
add_action("plugins_loaded", [$this, "load_textdomain"]);
add_action("wp_enqueue_scripts", [$this, "enqueue_styles"]);
add_action("widgets_init", [$this, "register_widgets"]);
}
private function includes()
{
require_once BBPS_INCLUDES_PATH . "core.php";
if (is_admin()) {
require_once BBPS_INCLUDES_PATH . "admin.php";
}
require_once BBPS_INCLUDES_PATH . "widgets.php";
}
public function activate()
{
$this->add_default_options();
if (get_option("bbps_enable_search_url_rewrite")) {
add_rewrite_rule('^search/([^/]+)/?$', 'index.php?s=$matches[1]', 'top');
flush_rewrite_rules(false);
}
do_action("bbps_activation");
}
public static function uninstall()
{
delete_option("bbps_default_status");
delete_option("bbps_enable_post_count");
delete_option("bbps_enable_user_rank");
delete_option("bbps_status_permissions");
delete_option("bbps_reply_count");
delete_option("bbps_used_status");
delete_option("bbps_enable_topic_move");
delete_option("bbps_status_permissions_urgent");
delete_option("bbps_claim_topic");
delete_option("bbps_claim_topic_display");
delete_option("bbps_topic_assign");
delete_option("bbps_notification_subject");
delete_option("bbps_notification_message");
delete_option("bbps_new_topic_days");
delete_option("bbps_enable_new_topic_label");
delete_option("bbps_enable_closed_topic_label");
delete_option("bbps_enable_sticky_topic_label");
delete_option("bbps_enable_search_integration");
delete_option("bbps_enable_search_url_rewrite");
delete_option("bbps_enable_post_author_label");
delete_option("bbps_include_posts_in_search");
delete_option("bbps_search_results_count");
delete_option("bbps_enable_private_replies");
delete_option("bbps_private_replies_capability");
delete_option("bbps_enable_seo_optimization");
delete_option("bbps_enable_meta_descriptions");
delete_option("bbps_meta_description_length");
delete_option("bbps_enable_open_graph");
delete_option("bbps_enable_twitter_cards");
delete_option("bbps_enable_schema_markup");
delete_option("bbps_enable_canonical_urls");
delete_option("bbps_forum_title_format");
delete_option("bbps_enable_email_fix");
delete_option("bbps_custom_email_from");
delete_option("bbps_enable_title_length_fix");
delete_option("bbps_max_title_length");
delete_option("bbps_remove_topic_tags");
delete_option("bbps_enable_default_forum");
delete_option("bbps_default_forum_id");
flush_rewrite_rules(false);
}
private function add_default_options()
{
$default_options = [
"bbps_default_status" => "1",
"bbps_enable_post_count" => "1",
"bbps_enable_user_rank" => "1",
"bbps_status_permissions" => [
"admin" => "1",
"mod" => "1",
"user" => "1",
],
"bbps_used_status" => [
"res" => "1",
"notres" => "1",
"notsup" => "1",
],
"bbps_enable_topic_move" => "1",
"bbps_status_permissions_urgent" => "1",
"bbps_claim_topic" => "1",
"bbps_claim_topic_display" => "0",
"bbps_topic_assign" => "1",
"bbps_notification_subject" => __(
"Your registration at %BLOGNAME%",
"bbpress-support-toolkit"
),
"bbps_notification_message" => __(
"Thanks for signing up to our blog.\n\nYou can login with the following credentials by visiting %BLOGURL%\n\nUsername : %USERNAME%\nPassword : %PASSWORD%\n\nWe look forward to your next visit!\n\nThe team at %BLOGNAME%",
"bbpress-support-toolkit"
),
"bbps_new_topic_days" => "30",
"bbps_enable_new_topic_label" => "1",
"bbps_enable_closed_topic_label" => "1",
"bbps_enable_sticky_topic_label" => "1",
"bbps_enable_search_integration" => "1",
"bbps_enable_search_url_rewrite" => "1",
"bbps_enable_post_author_label" => "1",
"bbps_include_posts_in_search" => "0",
"bbps_search_results_count" => "20",
"bbps_enable_private_replies" => "1",
"bbps_private_replies_capability" => "moderate",
"bbps_enable_seo_optimization" => "1",
"bbps_enable_meta_descriptions" => "1",
"bbps_meta_description_length" => "160",
"bbps_enable_open_graph" => "1",
"bbps_enable_twitter_cards" => "1",
"bbps_enable_schema_markup" => "1",
"bbps_enable_canonical_urls" => "1",
"bbps_forum_title_format" => "%topic_title% - %forum_name% | %site_name%",
"bbps_enable_email_fix" => "0",
"bbps_custom_email_from" => "no-reply@example.com",
"bbps_enable_title_length_fix" => "0",
"bbps_max_title_length" => "150",
"bbps_remove_topic_tags" => "0",
"bbps_enable_default_forum" => "0",
"bbps_default_forum_id" => ""
];
foreach ($default_options as $key => $value) {
add_option($key, $value);
}
}
public function load_textdomain()
{
load_plugin_textdomain(
"bbpress-support-toolkit",
false,
dirname(plugin_basename(__FILE__)) . "/languages/"
);
}
public function enqueue_styles()
{
wp_enqueue_style(
"bbps-style",
BBPS_ASSETS_URL . "style.css",
[],
BBPS_VERSION
);
}
public function register_widgets()
{
register_widget("BBPS_Support_Hours_Widget");
register_widget("BBPS_Resolved_Count_Widget");
register_widget("BBPS_Urgent_Topics_Widget");
register_widget("BBPS_Recently_Resolved_Widget");
register_widget("BBPS_Claimed_Topics_Widget");
register_widget("BBPS_Register_Widget");
}
}
function bbps()
{
return BBPress_Support_Toolkit::instance();
}
bbps();

1653
includes/admin.php Executable file

File diff suppressed because it is too large Load diff

1258
includes/core.php Executable file

File diff suppressed because it is too large Load diff

1011
includes/widgets.php Executable file

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff