Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
5.1k views
in Q2A Core by
edited by

I have this site where I let anonymous questions to be posted, but I realized that some users don't really want to post as an anon but just don't know they are doing it.

Is there a way to show a message in the ask page ( mysite.com/ask ) that just for unregistered or anon users? so I can put a warning like "You are asking a question as an anon, if you want, you can register here"

Thanks

Edit:

Using the idea given by q2apro.com I find that I need to add this in the place where I want the message to appear (in my case below $this->nav_main_sub(); inside qa-theme.php of the snow theme)

if (!qa_is_logged_in()) {
$this->output('MY MESSAGE');}
But I don't know how to check if I'm in the ask page or don't.
Q2A version: 1.6.3

2 Answers

0 votes
by
 
Best answer

So, I did some Research in the function and themes documentation, and got this:

 

It is just showed in the ask page using this code:

if (!qa_is_logged_in() and $this->template=='ask'){
$this->output('<br /><div class="qa-error"> Warning!! <br />MY MESSAGE</div>');
}
rigth after:
$this->nav_main_sub();
Hope it helps to somebody else.
 
Big thanks to q2apro.com who point me in the right direction.
 
+1 vote
by
edited by

Good idea.

Easy solution: When you use a captach for only anonymous guests that would be a "message" already. You could add a line to the captcha plugin "You are posting *anonymously*, please fill out the captcha".

---

Tutorial for showing an extra message:

1. open your qa-theme.php

2. add this code overriding the main() function:

        function main() {
             if(!qa_is_logged_in()) {
                 $this->output('<p>You are posting anonymously!</p>');
             }
            // default method call
            qa_html_theme_base::main();
        }

3. upload the qa-theme.php to your server
 

by
I have a message in the bottom of the reCaptcha module, but this is also in the bottom of the page, and I don't know how to put this on top of the page (both message and ReCaptcha) :(
by
I have updated my answer above.
by
edited by
Thanks for your reply, I'm using the "snow theme" that comes with Q2A 1.6.3 and there's no `function main()`

I edited the last part of the question.
by
you just "add this code" to the file qa-theme.php
...