Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
  • Register
Welcome to the Q&A for Question2Answer.

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

How to tell (from theme) that we're editing the question?

+1 vote

I have some special instructions that I display when the user is asking a question. This is simple, just using the `$this->template` variable. But when a user edits the question, `$this->template` is 'question' instead of 'ask'.

Is there another way to detect if the user is on the edit form?

UPDATE: see my answer. Is there a better way in v1.4??  qa_get('state') and $_GET['state'] are both blank.

 

asked Aug 19, 2010 in Q2A Core by DisgruntledGoat
edited Aug 20, 2011 by DisgruntledGoat

2 Answers

0 votes
Yes, you can check as follows:

if (isset($this->$content['q_edit_form'])) {
 ...
}
answered Aug 19, 2010 by gidgreen
0 votes

Just to update, this now appears to be 'form_q_edit' and not 'q_edit_form'.

Although I wonder if there is a better way to detect this in v1.4 since we request ?state=edit-1234. I've tried qa_get('state') function and $_GET['state'] but both come back blank.

answered Aug 20, 2011 by DisgruntledGoat