array( $this, 'sanitize_yesno' ), ) ); register_setting( 'aisp_cc_email_settings_group', AISP_CC_Email_User_Fields::ROLES_OPTION, array( 'type' => 'array', 'sanitize_callback' => array( $this, 'sanitize_roles' ), ) ); } /** * Sanitize the selected roles. Only existing roles are kept. * If nothing is selected, the default roles are used. * * @param mixed $value Raw input. * @return string[] Sanitized role slugs. */ public function sanitize_roles( $value ) { $existing = array_keys( wp_roles()->get_names() ); $roles = array_map( 'sanitize_key', (array) $value ); $roles = array_values( array_intersect( $roles, $existing ) ); if ( empty( $roles ) ) { add_settings_error( AISP_CC_Email_User_Fields::ROLES_OPTION, 'aisp_cc_email_no_roles', __( 'No role was selected. Default roles were restored.', 'aisp-cc-email-manager' ), 'warning' ); $roles = AISP_CC_Email_User_Fields::get_default_roles(); } return $roles; } /** * Sanitize "yes" / "no". * * @param mixed $value Raw input. * @return string Sanitized "yes" or "no". */ public function sanitize_yesno( $value ) { return ( 'yes' === $value ) ? 'yes' : 'no'; } /** * Render the settings page. */ public function render_settings_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $wc_statuses = function_exists( 'wc_get_order_statuses' ) ? wc_get_order_statuses() : array(); ?>

get_names(); $aisp_cc_allowed_roles = AISP_CC_Email_User_Fields::get_allowed_roles(); ?>







user_id, user_email, cc_email_1, cc_email_2, cc_email_1_statuses, cc_email_2_statuses