BP_Admin_Setting_Xprofile: settings_save ()
描述
源
文件:bp-core /管理/设置/ bp-admin-setting-xprofile.php
Public function settings_save() {$ if_disable_before_save = bp_disable_advanced_profile_search(); / /设置文件保存父:settings_save ();$ if_disabled_after_saving = bp_disable_advanced_profile_search ();/** *同步bp-enable-member-dashboard与自定义设置。* * @since BuddyBoss 1.0.0 */ $bp_nouveau_appearance = bp_get_option('bp_nouveau_appearance', array());$bp_nouveau_appearance['user_front_page'] = isset($_POST['bp-enable-member-dashboard']) ?$_POST['bp-enable-member-dashboard']: 0;$bp_nouveau_appearance['user_front_page_redirect'] = isset($_POST['bp-enable-member-dashboard-redirect']) ?$_POST['bp-enable-member-dashboard-redirect']: 0;bp_nouveau_option ('bp_nouveau_appearance', $bp_nouveau_appearance); //Set requirement for last name based on display format if ( isset( $_POST[ 'bp-display-name-format' ] ) && $_POST[ 'bp-display-name-format' ] == 'first_last_name' ) { if ( $last_name_field = xprofile_get_field( bp_xprofile_lastname_field_id() ) ) { $last_name_field->is_required = true; $last_name_field->save(); } } if ( $if_disabled_before_saving && ! $if_disabled_after_saving ) { /** * Advanced profile search was disabled before and is now enabled. * So ideally, the new 'profile search' menu should now be visible under users nav. * But that doesn't happen becuase by the time settings are updated, register_post_type hooks have already been executed. * So user doesn't see that untill next reload/request. * * To avoid that, we'll need to do a force redirect. */ wp_safe_redirect( bp_get_admin_url( 'admin.php?page=bp-settings&tab=bp-xprofile' ) ); exit(); } }