PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
bbp-core / includes / admin / menu / Approve_Topic.php

Approve_Topic.php in Forumax – AI Powered Advanced Community Forum Plugin 2.2.0, at includes/admin/menu/Approve_Topic.php

56 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace admin\menu;
3
4 defined( 'ABSPATH' ) || exit();
5
6 class Forumax_Approve_Topic {
7 public function __construct() {
8 add_action( 'admin_init', [ $this, 'approve_spam_topic' ] );
9 add_action( 'admin_init', [ $this, 'approve_pending_reply' ] );
10 }
11
12 public function approve_spam_topic() {
13 $approval_request = $_GET['bbpc_approve_topic_id'] ?? false;
14
15 if ( $approval_request ) {
16 // Verify user has permission to moderate topics
17 if ( ! current_user_can( 'moderate' ) ) {
18 wp_die( esc_html__( 'You do not have permission to approve topics.', 'forumax' ) );
19 }
20
21 // Verify nonce for CSRF protection
22 if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'bbpc_approve_topic_' . (int) $approval_request ) ) {
23 wp_die( esc_html__( 'Security check failed. Please try again.', 'forumax' ) );
24 }
25
26 bbp_approve_topic( (int) $approval_request );
27 wp_safe_redirect( admin_url( 'admin.php?page=forumax' ) );
28 exit;
29 }
30 }
31
32 public function approve_pending_reply() {
33 $approval_request = $_GET['bbpc_approve_reply_id'] ?? false;
34
35 if ( $approval_request ) {
36 // Verify user has permission to moderate replies
37 if ( ! current_user_can( 'moderate' ) ) {
38 wp_die( esc_html__( 'You do not have permission to approve replies.', 'forumax' ) );
39 }
40
41 // Verify nonce for CSRF protection
42 if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'bbpc_approve_reply_' . (int) $approval_request ) ) {
43 wp_die( esc_html__( 'Security check failed. Please try again.', 'forumax' ) );
44 }
45
46 bbp_approve_reply( (int) $approval_request );
47 wp_safe_redirect( admin_url( 'admin.php?page=forumax' ) );
48 exit;
49 }
50 }
51 }
52
53 new Forumax_Approve_Topic();
54
55
56