[Tex/LaTex] In moderncv how to change \extrainfo xing from http to https

hyperrefmoderncv

In moderncv: I added my xing profile using \extrainfo according to this source

However, the link is http and I'd like to change to https.

Additional Info:
It might be possible to adapt this instruction on how to change the social linkedin profile, but it didn’t found out how.

Minimal Working Example:

\documentclass{moderncv}
\moderncvstyle{casual}
\makeatletter
\RenewDocumentCommand{\social}{O{}O{}m}{%
  \ifthenelse{\equal{#2}{}}%
    { 
    \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\href{https://www.linkedin.com/in/#3}{#3}}}{}%
      \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httplink[#3]{www.twitter.com/#3}}}    {}%
      \ifthenelse{\equal{#1}{github}}  {\collectionadd[github]{socials}  {\protect\httplink[#3]{www.github.com/#3}}}     {}%
    }
    {\collectionadd[#1]{socials}{\protect\httplink[#3]{#2}}}}
\makeatother
\name{Daniel}{Nahmias}
\social[linkedin]{danielnahmias} 
%\social[xing]{Daniel_Nahmias} % currently doesn't work, so that I use \extrainfo
%\social[twitter]{jdoe}        not needed
%\social[github]{jdoe}        not needed
%\social[gitlab]{jdoe}        not needed
%\social[skype]{jdoe}        not needed
\extrainfo{\httplink[\faXingSquare~Daniel Nahmias]{xing.com/profile/Daniel_Nahmias}} 
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\end{document}

Best Answer

You have to change three things:

  1. You need to add a new definition for the xing symbol: \newcommand*{\xingsocialsymbol} {\faXingSquare~}
  2. Add a new command \httpslink like

    \newcommand*{\httpslink}[2][]{% <=======================================
      \ifthenelse{\equal{#1}{}}%
        {\href{https://#2}{#2}}%
        {\href{https://#2}{#1}}}
    
  3. Add a new definition for xing in socials command:

    \ifthenelse{\equal{#1}{xing}}{\collectionadd[xing]{socials}{\protect\httpslink[#3]{www.xing.com/profile/#3}}}{}%
    

So with the following complete MWE

\documentclass{moderncv}

% makes a https hyperlink
% usage: \httpslink[optional text]{link}
\newcommand*{\httpslink}[2][]{% <=======================================
  \ifthenelse{\equal{#1}{}}%
    {\href{https://#2}{#2}}%
    {\href{https://#2}{#1}}}

\newcommand*{\xingsocialsymbol}  {\faXingSquare~} % <===================

\moderncvstyle{casual}

\makeatletter
\RenewDocumentCommand{\social}{O{}O{}m}{%
  \ifthenelse{\equal{#2}{}}%
    { 
    \ifthenelse{\equal{#1}{linkedin}}{\collectionadd[linkedin]{socials}{\protect\href{https://www.linkedin.com/in/#3}{#3}}}{}%
    \ifthenelse{\equal{#1}{xing}}{\collectionadd[xing]{socials}{\protect\httpslink[#3]{www.xing.com/profile/#3}}}{}% <================================================================
      \ifthenelse{\equal{#1}{twitter}} {\collectionadd[twitter]{socials} {\protect\httplink[#3]{www.twitter.com/#3}}}    {}%
      \ifthenelse{\equal{#1}{github}}  {\collectionadd[github]{socials}  {\protect\httplink[#3]{www.github.com/#3}}}     {}%
    }
    {\collectionadd[#1]{socials}{\protect\httplink[#3]{#2}}}}
\makeatother

\name{Daniel}{Nahmias}
\social[linkedin]{danielnahmias} 
\social[xing]{Daniel\_Nahmias} % <======================================
%\social[twitter]{jdoe}        not needed
%\social[github]{jdoe}        not needed
%\social[gitlab]{jdoe}        not needed
%\social[skype]{jdoe}        not needed


\begin{document}

\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\end{document}

you get the wished result:

enter image description here