How do I prevent users from changing question titles in a question2answer Script?

Bhavesh S November 29, 2013
Pinterest Stumbleupon Whatsapp

I recently modified question2answer script on 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.

Ads by Google

  1. Bhavesh S
    November 30, 2013 at 7:09 am

    I also asked in help forum from question2answer forum and I got answer for the same. I would like to share it here.We have to change little moditication in qa-theme.php file as below.

    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);
    }

    Now user will not be able to modify question titles once their question has been published on http://www.ehowportal.com/answers/

    Source : http://www.question2answer.org/qa/29404/how-to-prevent-user-changing-title-of-their-own-questions
    Special thanks : sama