__( 'Topic Replies', 'forumax' ), 'icon' => 'dashicons dashicons-format-chat', 'fields' => [ [ 'id' => 'is_ajax_reply', 'type' => 'switcher', 'default' => false, 'title' => __( 'AJAX Reply', 'forumax' ), 'subtitle' => __( 'Enable instant reply submission without page reload. Replies appear in real-time via AJAX.', 'forumax' ), 'class' => 'st-promax-notice' ], [ 'id' => 'replies_per_page', 'type' => 'number', 'title' => __( 'Replies Per Page', 'forumax' ), 'subtitle' => __( 'Set how many replies are shown per topic page. Pagination links appear after this limit is exceeded.', 'forumax' ), 'desc' => __( 'This setting reuses bbPress reply pagination option. Example: 15 means pagination starts from 16 replies.', 'forumax' ), 'default' => (int) get_option( '_bbp_replies_per_page', 15 ), 'min' => 1, 'max' => 100, ], [ 'id' => 'is_bbpc_insert_media', 'type' => 'switcher', 'default' => false, 'title' => __( 'Insert Media', 'forumax' ), 'subtitle' => __( 'Enable/Disable the custom image insert button with upload & URL modal for editors.', 'forumax' ), 'class' => 'st-pro-notice' ], [ 'id' => 'is_auto_approval_replies', 'type' => 'switcher', 'default' => false, 'title' => __( 'Auto Approval', 'forumax' ), 'subtitle' => __( 'Enable/ Disable Auto Approval feature.', 'forumax' ), 'class' => 'st-pro-notice' ], [ 'id' => 'is_attachment_replies', 'type' => 'button_set', 'title' => __( 'Replies with Attachments', 'forumax' ), 'subtitle' => __( 'Approve or Unapprove if attachment is added with the reply', 'forumax' ), 'class' => 'st-pro-notice', 'options' => array( '1' => 'Approve', '0' => 'Unapprove', ), 'default' => '1', 'dependency' => [ 'is_auto_approval_replies', '==', 'true', ], ], [ 'id' => 'is_private_replies', 'type' => 'switcher', 'default' => 1, 'title' => __( 'Private Replies', 'forumax' ), 'subtitle' => __( 'Enable/ Disable Private Replies feature.', 'forumax' ), ], [ 'id' => 'anonymous_reply', 'type' => 'switcher', 'title' => __( 'Anonymous Reply', 'forumax' ), 'subtitle' => __( 'Allow anonymous to reply a topic.', 'forumax' ), 'class' => 'st-pro-notice' ], [ 'id' => 'anonymous_reply_label', 'type' => 'text', 'title' => __( 'Anonymous Label', 'forumax' ), 'default' => __( 'Post Anonymously', 'forumax' ), 'dependency' => [ 'anonymous_reply', '==', 'true', ], 'class' => 'st-pro-notice' ], [ 'id' => 'replies_react_voting', 'type' => 'switcher', 'title' => __( 'React Reactions', 'forumax' ), 'subtitle' => __( 'To enable or disable the react reactions.', 'forumax' ), 'class' => 'st-promax-notice', 'default' => false ], [ 'id' => 'replies_react_label', 'type' => 'text', 'title' => __( 'React Button Text', 'forumax' ), 'default' => __( 'React', 'forumax' ), 'class' => 'st-promax-notice', 'dependency' => [ 'replies_react_voting', '==', 'true', ] ], [ 'id' => 'reply_timeline_enabled', 'type' => 'switcher', 'title' => __( 'Reply Timeline Navigation', 'forumax' ), 'subtitle' => __( 'Enable/Disable Discourse-style vertical timeline navigation for replies.', 'forumax' ), 'class' => 'st-promax-notice', 'default' => false ], [ 'id' => 'frmx_nested_replies', 'type' => 'switcher', 'title' => __( 'Nested Replies', 'forumax' ), 'subtitle' => __( 'Enable threaded / nested replies so users can reply directly to a specific reply.', 'forumax' ), 'class' => 'st-promax-notice', 'default' => false, ], [ 'id' => 'frmx_nested_replies_depth', 'type' => 'select', 'title' => __( 'Nesting Depth', 'forumax' ), 'subtitle' => __( 'Maximum depth of nested replies.', 'forumax' ), 'class' => 'st-promax-notice', 'default' => '3', 'options' => array( '2' => __( '2 levels', 'forumax' ), '3' => __( '3 levels', 'forumax' ), '4' => __( '4 levels', 'forumax' ), '5' => __( '5 levels', 'forumax' ), ), 'dependency' => array( 'frmx_nested_replies', '==', 'true' ), ], ] ] ); if ( ! function_exists( 'forumax_sync_bbp_replies_per_page_option' ) ) { /** * Sync Forumax replies-per-page setting to bbPress core option. * * @param array $data Saved Forumax settings. * @return void */ function forumax_sync_bbp_replies_per_page_option( $data, $options = null ) { if ( ! is_array( $data ) || ! isset( $data['replies_per_page'] ) ) { return; } $replies_per_page = absint( $data['replies_per_page'] ); if ( $replies_per_page < 1 ) { $replies_per_page = 15; } update_option( '_bbp_replies_per_page', $replies_per_page ); } } add_action( 'csf_bbp_core_settings_save_after', 'forumax_sync_bbp_replies_per_page_option', 10, 2 ); if ( ! function_exists( 'forumax_sync_replies_per_page_field_from_bbp' ) ) { /** * Keep Forumax field value aligned with bbPress replies-per-page option. * * @return void */ function forumax_sync_replies_per_page_field_from_bbp() { $bbp_replies_per_page = absint( get_option( '_bbp_replies_per_page', 15 ) ); if ( $bbp_replies_per_page < 1 ) { $bbp_replies_per_page = 15; } $forumax_settings = get_option( 'bbp_core_settings', array() ); if ( ! is_array( $forumax_settings ) ) { $forumax_settings = array(); } $current_value = isset( $forumax_settings['replies_per_page'] ) ? absint( $forumax_settings['replies_per_page'] ) : 0; if ( $current_value === $bbp_replies_per_page ) { return; } $forumax_settings['replies_per_page'] = $bbp_replies_per_page; update_option( 'bbp_core_settings', $forumax_settings ); } } add_action( 'admin_init', 'forumax_sync_replies_per_page_field_from_bbp', 20 );