Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
706 views
in Q2A Core by
I have installed this on my wordpress folder at http://www.ehowportal.com/answers/

 

I created a test post with self as user and posted one question. I then re-edited my question title there and I have seen its premalink was also changed while changing titles. I as a moderator/admin can change titles but I don’t want any users to changes their post’s title. Please let me know how can achieve this.

2 Answers

+2 votes
by
selected by
 
Best answer

Nice question. There are other methods to be realized. Lower example is a method not to change Q2A core. Add function below to your theme, and change HTML form in question editing page. I show three kinds of methods. Method 2 may be good for user interface. Choose it depending on your needs.

Source file : qa-theme/(Your theme)/qa-theme.php

Function :

function form_field_rows($form, $columns, $field) {
  if(isset($field['tags']) && $field['tags'] =='name="q_title"') {
    if(qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) {
      // Method1
      //$field['tags'] .= ' readonly="readonly"';
      
      // Method2
      //$field['label'] = '';
      $field['label'] = 'Title:';
      $field['type'] = 'static';
      
      // Method3
      //$field['label'] = '';
      //$field['tags'] .= ' type="hidden"';
    }
  }
  qa_html_theme_base::form_field_rows($form, $columns, $field);
}
P.S.
Because post-record is broken, you must not use method below.
//$field['tags'] .= ' disabled="disabled"';
by
I did the same and second methods seems working.
Thanks a lot sama.
+1 vote
by
The best way to do this is probably with a filter plugin - http://question2answer.org/modules.php?module=filter

Use the filter_question function, check for $oldquestion to see if it's an edit, then check qa_get_logged_in_level() to see if the user is allowed to edit the title. You should be able to revert the question to the old title there.

By the way, is there really any good reason to prevent editing of the title? The question lookup actually depends on the ID in the URL, so "/123/my-quetion" and "/123/my-question" show the same page, and with a canonical meta tag so that the true URL is displayed in Google.
by
This way is no good for user interface.
by
Why is it not good for UI?
...