I came across this question that was posted before and have been using the solution for a while. However, I can't seem to get the same thing to work with starred environments.
I am aware that long theorem titles have been a long-standing bug with ntheorem. However, some pointers as to how I can workaround this, if there exists one such workaround out there, is appreciated.
The following is a MWE using the tufte class, just to stay consistent with my usual setup.
\documentclass{tufte-book}
\usepackage{etoolbox}
\usepackage{ntheorem}
% Workaround for long titles in ntheorem
\makeatletter
\let\nobreakitem\item
\let\@nobreakitem\@item
\patchcmd{\nobreakitem}{\@item}{\@nobreakitem}{}{}
\patchcmd{\nobreakitem}{\@item}{\@nobreakitem}{}{}
\patchcmd{\@nobreakitem}{\@itempenalty}{\@M}{}{}
\patchcmd{\@xthm}{\ignorespaces}{\nobreak\ignorespaces}{}{}
\patchcmd{\@ythm}{\ignorespaces}{\nobreak\ignorespaces}{}{}
\renewtheoremstyle{break}%
{\item{\theorem@headerfont
##1\ ##2\theorem@separator}\hskip\labelsep\relax\nobreakitem}%
{\item{\theorem@headerfont
##1\ ##2\ (##3)\theorem@separator}\hskip\labelsep\relax\nobreakitem}
\makeatother
\theoremstyle{break}
\theoremprework{\textcolor{magenta}{\hrule height 2pt width \textwidth}}
\theoremheaderfont{\color{magenta}\normalfont\bfseries}
\theorempostwork{\textcolor{magenta}{\hrule height 2pt width \textwidth}}
\theoremindent10pt
\newtheorem{theorem}{Theorem}
\theoremprework{\textcolor{magenta}{\hrule height 2pt width \textwidth}}
\theoremheaderfont{\color{magenta}\normalfont\bfseries}
\theorempostwork{\textcolor{magenta}{\hrule height 2pt width \textwidth}}
\theoremindent10pt
\newtheorem*{theoremn}{Theorem}
\begin{document}
\begin{theorem}[Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem]
This is a numbered theorem.
\end{theorem}
\begin{theoremn}[Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem Theorem]
This is an unnumbered theorem.
\end{theoremn}
\end{document}
The following is an image of how it looks like:

For those who intend to recommend amsthm, note that I cannot achieve the styling of theorem environments that I can do with ntheorem, which is why I would prefer to find a solution with ntheorem, rather than dropping it. Also, the use of frames (e.g. mdframed) is a no-go, since I am also using the tufte class, and I greatly rely on having ample side notes and margin notes in my documents.
