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

I am using an advanced theme, and overwrite the function body_content

I added:

       // do not show to loggedin users and show only on question pages
       if( empty($userid) && ($this->template=='question') ) {
            $this->output('<p>Hi stranger</p>');
       }


empty($userid) should return false if a user is logged in. However, even for logged-in users the output message is shown (i.e. empty($userid) returns true).

Anyone can confirm this + suggest a workaround? thx

1 Answer

0 votes
by
selected by
 
Best answer

Call qa_is_logged_in(...) which is defined in qa-app-users.php

by
thanks Gideon!

PS: $userid in my code above was always empty because I forgot to fetch it with: $userid=qa_get_logged_in_userid();

But with qa_is_logged_in() I save one line now :)
...