Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
779 views
in Q2A Core by

Been trying to edit this code which is for accessing user profiles when clicking their name,  i want to show the user id number instead of the username/handle

function qa_get_one_user_html($handle, $microformats)
  
 /*
  Return HTML to display for user with username $handle
 */
  {
   
   return strlen($handle) ? ('<A HREF="'.qa_path_html('user/'.$handle).
    '" CLASS="qa-user-link'.($microformats ? ' url nickname' : '').'">'.qa_html($handle).'</A>') : '';
  }

 

I know that.. for example.. www.question2answer.org/qa/user/234 will not work, but that's not what I'm trying to achieve, I plan to link the user to another page that requires their id

1 Answer

+1 vote
by
selected by
 
Best answer

there are some new functions in 1.5, one of which is qa_handles_to_userids().  It's used as follows:

            $userids = qa_handles_to_userids(array($handle));
            $userid = $userids[$handle];

If I understand you correctly, this is probably the easiest way.

by
that was exactly what i needed. thanks!
...