WordPress.org

Ready to get started?Download WordPress

Forums

YOP Poll
[resolved] Default sort by Start Date (6 posts)

  1. wm
    Member
    Posted 1 month ago #

    Hi

    On the pages "Yop Poll" and "Yop Poll Logs" I want to have the default sort order (for all users) by "Start Date" instead of "Poll name". Any1 seen that settings and can hint what to change plz?

    https://wordpress.org/plugins/yop-poll/

  2. YOP
    Member
    Plugin Author

    Posted 1 month ago #

    Hi wm,

    Edit admin.php and in view_all_polls() function replace

    $orderby                    = ( empty ( $orderby ) ) ? 'name' : $orderby;

    with

    $orderby                    = ( empty ( $orderby ) ) ? 'start_date' : $orderby;

    Best wishes,

    YOP Team

  3. wm
    Member
    Posted 1 month ago #

    Thanks for a fast answer. Its in the right area and solve some of my question.

    1. A would like to have the order reversed (DESC) where to add this?

    2. This adjustment seems to not affect the page "Yop Poll Logs".

  4. YOP
    Member
    Plugin Author

    Posted 1 month ago #

    Hey wm,

    1. In view_all_polls() function add

    if($order=="")
                         $order="desc";

    before

    $yop_polls               = Yop_Poll_Model::get_yop_polls_filter_search( $orderby, $order, $filter, $search );

    2. For YOP Poll Logs we can sort them only after Vote Date. Let us know if you are interested and we will provide the code.

    Regards,

    YOP Team

  5. wm
    Member
    Posted 1 month ago #

    Thanks for another superfast answer. The code you provided solved my request perfect.

    public function view_all_polls() {
    			global $page, $action, $orderby, $order, $current_user;
    			$orderby                    = ( empty ( $orderby ) ) ? 'start_date' : $orderby; $order="desc";

    As the members only (mostly) are interrested in the latest poll it would be great to be able to sort the "Yop poll logs" in the same way after "vote date, desc". Thanks in advance is you look into this in the future.

  6. YOP
    Member
    Plugin Author

    Posted 1 month ago #

    Hey wm,

    We will take your suggestion into consideration and try to implement it in the future.

    Best wishes,

    YOP Team

Reply

You must log in to post.

About this Plugin

About this Topic