0 && user_can( $user_id, 'edit_posts' ); /** * Filter whether the current user can have the Comments window registered. * * @since 0.19.0 * * @param bool $can Default: `edit_posts` capability. * @param int $user_id User being checked. */ return (bool) apply_filters( 'desktop_mode_comments_window_user_can_register', $can, $user_id ); } /** * Combined cap-and-opt-in check. * * @since 0.19.0 * * @param int|null $user_id Optional. * @return bool */ function desktop_mode_comments_window_user_can_use( $user_id = null ) { $user_id = null === $user_id ? get_current_user_id() : (int) $user_id; $cap_ok = desktop_mode_comments_window_user_can_register( $user_id ); $opt_in = false; if ( $cap_ok && function_exists( 'desktop_mode_get_os_settings' ) ) { $settings = desktop_mode_get_os_settings( $user_id ); $opt_in = ! empty( $settings['nativeCommentsEnabled'] ); } $can = $cap_ok && $opt_in; /** * Filter whether the current user has opted into the native Comments experience. * * @since 0.19.0 * * @param bool $can Default gate result. * @param int $user_id User being checked. */ return (bool) apply_filters( 'desktop_mode_comments_window_user_can_use', $can, $user_id ); }