Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
1.1k views
in Q2A Core by
I have added some ads at file qa-theme-base.php, using this:

***************
        function main()
        {
            $content=$this->content;

            $this->output('<DIV CLASS="qa-main'.(@$this->content['hidden'] ? ' qa-main-hidden' : '').'">');


switch ($this->template) {
        case 'question':
include('ads_single.php');
break;
}

***************

ads_single.php is just a text file with my ads script.

As you can see I want to show ads before the title, but only on questions pages.

This works fine, but I want to show ads only for non-logged users. How can I verify this?
by
I'm also curious about this.

1 Answer

+4 votes
by
Test if a user is logged in as follows:

global $qa_login_userid;

if (isset($qa_login_userid)) {
 // a user is logged in
} else {
 // no user is logged in
}

As a general comment I recommend also doing this via your own theme to override just the parts you want, rather than modifying qa-theme-base.php, so you won't have issues upgrading in future. For more info on advanced themes: http://www.question2answer.org/advanced.php#theme-advanced
by
Thank you very much!

I will study custom themes soon, this will help me by now.
by
Not working on new q2a
...