BP_Admin_Setting_Forums

主论坛设置类。

描述

文件:bp-core /管理/设置/ bp-admin-setting-forums.php

class BP_Admin_Setting_Forums {public function initialize() {$this->tab_label = __('Forums', 'buddyboss');$ this - > tab_name =“bp-forums”;$ this - > tab_order = 30;} public function is_active() {return bp_is_active('论坛');}公共函数settings_save() {$sections = bbp_admin_get_settings_sections();Foreach ((array) $sections as $section_id => $section) {$fields = bbp_admin_get_settings_fields_for_section($section_id);foreach ((array) $fields as $field_id => $field) {$value = isset($_POST[$field_id]) ?美元$ _POST [field_id]:”;If (is_callable($field['sanitize_callback']) {$value = $field['sanitize_callback']($value);} bp_update_option($field_id, $value); } } flush_rewrite_rules(); } public function settings_saved() { $url = bp_core_admin_setting_url( $this->tab_name, [ 'edited' => 'true' ] ); bp_core_redirect( $url ); } public function register_fields() { $sections = bbp_admin_get_settings_sections(); $fields = bbp_admin_get_settings_fields(); foreach ( (array) $sections as $section_id => $section ) { // Only proceed if current user can see this section if ( ! current_user_can( $section_id ) ) { continue; } // Only add section and fields if section has fields $fields = bbp_admin_get_settings_fields_for_section( $section_id ); if ( empty( $fields ) ) { continue; } // Add the section $this->add_section( $section_id, $section['title'], $section['callback'] ); // Loop through fields for this section foreach ( (array) $fields as $field_id => $field ) { if ( ! empty( $field['callback'] ) && !empty( $field['title'] ) ) { $this->add_field( $field_id, $field['title'], $field['callback'], $field['sanitize_callback'], $field['args'] ); } } } } }

更新日志

更新日志
版本 描述
BuddyBoss 1.0.0 介绍了。

方法

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队