Finding all functions $f:\mathbb R\to\mathbb R$ which satisfy $f(xy)=yf(x)+x+f\bigl(f(y)-f(x)\bigr)$ -Closed: It has a solution in AOPS.-

Find all functions $f:\mathbb R\to\mathbb R$ which satisfy $$f(xy)=yf(x)+x+f\bigl(f(y)-f(x)\bigr)$$
for all $x,y\in\mathbb R$.

My attempt:
\begin{align}
&P(x, x): f\left(x^2\right)=xf(x)+x+f(0). \\
&x=1; \ f(0)=-1. \\
\\
&P(x, 0): -1=x+f\bigl(-1-f(x)\bigr). \implies f\bigl(-f(x)-1\bigr)=-x-1. \\
&x=-1; f\bigl(-f(-1)-1\bigr)=0. \implies \exists t \ \text{ s.t. } f(t)=0. \\
\\
&P(t, 0): -1=t+f(-1). \\
&P(0, t): -1=-t+f(-1). \\
&\therefore 2t=f(1)-f(-1).
\ \\
&P(-1, 1): f(-1)=-f(1)+1+f(-2t). \\
&f(-1)+f(1)-2+f(2t)-f(-2t)=0.
\end{align}
 A: It's straightforward to verify that both $ f = x \mapsto x - 1 $ and $ f = x \mapsto - x - 1 $ satisfy
$$ f ( x y ) = y f ( x ) + x + f \bigl ( f ( y ) - f ( x ) \bigr ) \tag 0 \label 0 $$
for all $ x , y \in \mathbb R $. We prove that those are the only $ f : \mathbb R \to \mathbb R $ with this property.
Putting $ x = y = 1 $ in \eqref{0} we get $ f ( 0 ) = - 1 $. Hence, setting $ y = 0 $ in \eqref{0} we have
$$ f \bigl ( - 1 - f ( x ) \bigr ) = - x - 1 \tag 1 \label 1 $$
for all $ x \in \mathbb R $, while setting $ x = 0 $ in \eqref{0} we have
$$f \bigl ( f ( y ) + 1 \bigr ) = y - 1 \tag 2 \label 2 $$
for all $ y \in \mathbb R $. Letting $ y = - 1 - f ( x ) $ in \eqref{2} and using \eqref{1} we get
$$ f ( - x ) + f ( x ) = - 2 \tag 3 \label 3 $$
for all $ x \in \mathbb R $. Interchanging $ x $ and $ y $ in \eqref{0}, we have
$$ f ( y x ) = x f ( y ) + y + f \bigl ( f ( x ) - f ( y ) \bigr ) \tag 4 \label 4 $$
for all $ x , y \in \mathbb R $. Adding \eqref{4} to \eqref{0} and using \eqref{3}, we can see that
$$ 2 f ( x y ) = x f ( y ) + y f ( x ) + x + y - 2 $$
for all $ x , y \in \mathbb R $, which when $ y = 1 $ gives
$$ f ( x ) = a x - 1 $$
for all $ x \in \mathbb R $, where $ a = f ( 1 ) + 1 $. Therefore
$$ f \bigl ( f ( 1 ) + 1 \bigr ) = f ( a ) = a ^ 2 - 1 \text , $$
which by setting $ y = 1 $ in \eqref{2} shows that we must have $ a \in \{ - 1 , 1 \} $, and we're done.
A: Solution from AOPS:
\begin{align}
&\text{let } P(x, y): f(xy)=yf(x)+x+f(f(y)-f(x)). \\
\ \\
&P(x, 1): f(f(1)=f(x))=-x. \Rightarrow f: \text{ Bijective.} \\
\ \\
&P(x, 0): f(-f(x)=1)=-x-1. \\
&P(0, x): x-1=f(f(x)+1). \\
&\therefore f(f(x)+1)+f(-f(x)-1)=-2. \\
&\text{Because } f \text{ is surjective, } f(-x)+f(x)=-2. \\
\ \\
&P(-x, -y): \\
&f(xy)=-yf(-x)-x+f(f(-y)-f(-x)) \\
&\ \ \ \ \ \ \ \ \ \ =-y(-2-f(x))-x+f((-2-f(y))-(-2-f(x))) \\
&\ \ \ \ \ \ \ \ \ \ =-y+yf(x)-x+f(f(x)-f(y)) \\
&\ \ \ \ \ \ \ \ \ \ =2y+yf(x)-x-f(f(y)-f(x))-2. \\
\ \\
&\text{Comparing this to the original F.E.: } \\
&yf(x)+x+f(f(y)-f(x))=2y+yf(x)-x-f(f(y)-f(x))-2 \\
& \Rightarrow 2f(f(y)-f(x))=2y-2x-2 \Rightarrow f(f(y)-f(x))=y-x-1. \\
\ \\
&\text{Contributing this to the original F.E.: } \\
&f(xy)=yf(x)+y-1. \\
&x=1; f(y)=yf(1)+y-1. \\
& \Rightarrow f(xy)-f(y)=y(f(x)-f(1)). \\
&x=0; -1-f(y)=-y-yf(1). \\
&\Rightarrow f(y)+1=y(f(1)+1). \\
&\text{let } f(1)+1=c. \\
& \Rightarrow \dfrac {f(y)+1}{y}=c. \\
&\Rightarrow f(y)=cy-1. \\
\ \\
&\text{Contributing this to the original F.E.:} \\
&cxy-1=cxy-y+x+c^2(y-x)-1. \\
&\Rightarrow x-y+c^2(y-x)=0. \\
&\Rightarrow (y-x)(c^2-1)=0. \\
&\text{For }x \neq y: \ c^2=1, \ c=\pm 1. \\
\ \\
&\therefore f(x)=\pm x-1.
\end{align}
