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

We once had the question how to check if the user looks onto his profile page: http://www.question2answer.org/qa/26133/how-to-determine-if-user-looks-onto-his-profile-page

Answer was to read the $userid from content['raw']['account']['userid'].

However, the account data is not available on the pages:



I have no safe way to check if the user looks onto his own profile. 

Only workaround is to read in the URL and process and be lucky that it is a correct match.


Thinking about this, I guess it is nearly a bug...

Q2A version: 1.7.1
What I am doing as the workaround (unsafe):
function q2apro_gethandle_from_url() {
    $handle = preg_replace( '#^user/([^/]+)#', "$1", $this->request );
    // remove /questions from $handle
    $handle = str_replace('/questions', '', $handle);
    // remove /answers from $handle
    $handle = str_replace('/answers', '', $handle);
    return $handle;

Please log in or register to answer this question.