arshidkv12 / contact-form-cfdb7

Database addon for Contact Form 7 WordPress plugin. Save and manage Contact Form 7 messages.
https://ciphercoin.com
GNU Affero General Public License v3.0
13 stars 28 forks source link

Date should be sorted on the database side otherwise sort isn't done across pagination. #1

Closed Zeldern closed 6 years ago

Zeldern commented 6 years ago

When sorting by date it doesn't sort across pages but only the current page.

Example (probably shouldn't be used):

`$orderby = (isset($_GET['orderby'])) ? strreplace('-', '', $_GET['orderby']) : 'form_date'; $order = (isset($_GET['order'])) ? strreplace('-', '', $_GET['order']) : 'asc';

    if ( ! empty($search) ) {

       $results = $cfdb->get_results( "SELECT * FROM $table_name WHERE  form_value LIKE '%$search%' ORDER BY `$orderby` $order LIMIT $start,10", OBJECT );
    }else{

        $results = $cfdb->get_results( "SELECT * FROM $table_name WHERE form_post_id = $form_post_id ORDER BY `$orderby` $order LIMIT $start,10", OBJECT );
    }`
arshidkv12 commented 6 years ago

Thank you. I will check it.

arshidkv12 commented 6 years ago

It is fixed. (version 1.1.9)