\documentclass{article}
\makeatletter
\newcommand{\firstadvisor}[1]{\def\@firstadvisor{#1}}
\newcommand{\secondadvisor}[1]{\def\@secondadvisor{#1}}
\newcommand{\printtest}{%
\ifx\@firstadvisor\undefined%
\ifx\@secondadvisor\undefined%
\else\fi
\else
\ifx\@secondadvisor\undefined%
Ostad Moshaver: \@firstadvisor
\else
Ostad(an) Moshaver: \@firstadvisor{} and \@secondadvisor
\fi\fi}
\makeatother
\begin{document}
ُThis is a test.\\[5pt]
%\firstadvisor{Vahid}
%\secondadvisor{Mehdi}
\printtest
\end{document}