• Resolved imslee100

    (@imslee100)


    Hello. I want to translate the column name to show front page since mysql column name is in English.

    If I use translation with following way, display is ok, but I can’t update column because plugin detect translation as column name(attribute).

    Is there any alternative to display translation on listing page and edting is working too ?

    // in function.php
    add_db_table_editor(‘title=[??]??? ????&table=student_contests&sql=SELECT id, contest_id as ????, post_title as ????, name as ??, grade as ??, class as ?, title as ???, school as ???, address as ????, sender as ???, phone as ????, p_delivery as ???????, p_invoice_num as ????, pre_state as ?? FROM student_contests ORDER BY id DESC’);

    // error message from ajax response text
    <div id=”error”><p class=”wpdberror”>WordPress ?????? ??: [Unknown column '????' in 'field list']
    UPDATE student_contests SET ???? = 'aa', ???? = '?2? ????????(???) ?????', ?? = '??3', ?? = '??3', ? = '?3', ??? = '???3', ??? = '??3', ???? = '????3', ??? = NULL, ???? = '010-0000-0000', ??????? = NULL, ???? = NULL, ?? = '?????' WHERE id = '274'</p></div>[]

    https://www.ads-software.com/plugins/wp-db-table-editor/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bobbysmith007

    (@bobbysmith007)

    Checkout the add_db_table_editor parameter columnNameMap

    From the readme:

    columnNameMap: A map of actual column names to displayed label, EG: columnNameMap=>Array(‘column_name’=>’Column Alias’);

    Hope this helps, but let me know if you have trouble still

    Thread Starter imslee100

    (@imslee100)

    Hello. I modified the code like following, but alias dosn’t showing at all. But there is no error.

    Could you please fix the code or give me the example how to use “columnNameMap” with “add_db_table_editor” ?

    ———– code ———————-

    add_db_table_editor(array(“title”=>”[??]??? ????”,”table”=>”student_contests”,”sql”=>”SELECT id, contest_id, post_title, name, grade, class, title, school, address, sender, phone, p_delivery, p_invoice_num, pre_state FROM student_contests ORDER BY id DESC”,”columnNameMap=>array(‘contest_id’=>’????’, ‘post_title’=>’????’, ‘name’=>’??’, ‘grade’=>’??’, ‘class’=> ‘?’, ‘title’=>’???’, ‘school’=>’???’, ‘address’=>’????’, ‘sender’=>’???’, ‘phone’=>’????’, ‘p_delivery’=>’???????’, ‘p_invoice_num’=>’????’, ‘pre_state’=>’??’)”));

    Plugin Author bobbysmith007

    (@bobbysmith007)

    “columnNameMap=>array(‘contest_id’=>’????’, ‘post_title’=>’????’, ‘name’=>’??’, ‘grade’=>’??’, ‘class’=> ‘?’, ‘title’=>’???’, ‘school’=>’???’, ‘address’=>’????’, ‘sender’=>’???’, ‘phone’=>’????’, ‘p_delivery’=>’???????’, ‘p_invoice_num’=>’????’, ‘pre_state’=>’??’)”

    That seems like a parse error (the double quote is at the very end). You should quote the key and not the array as follows:

    “columnNameMap”=>array(‘contest_id’=>’????’, ‘post_title’=>’????’, ‘name’=>’??’, ‘grade’=>’??’, ‘class’=> ‘?’, ‘title’=>’???’, ‘school’=>’???’, ‘address’=>’????’, ‘sender’=>’???’, ‘phone’=>’????’, ‘p_delivery’=>’???????’, ‘p_invoice_num’=>’????’, ‘pre_state’=>’??’)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to make translation column name is working with editing column ?’ is closed to new replies.