• Resolved airdrummer

    (@airdrummer)


    feature request: i would like to be able to sort polls on the admin page by date or id…and displaying id without having to click on the code link would be nice…just add the id to yop-poll-get-shortcode link;-)

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter airdrummer

    (@airdrummer)

    here ya go:

    yop-poll/admin/models/polls-list.php:88-93:

    public function column_code( $item ) {
    	return sprintf(
    		'%s <span class="dashicons dashicons-shortcode"></span>',
    		absint($item['id']),absint( $item['id'])
    		);
    }

    yop-poll/admin/models/polls-list.php:163++:

    			'code' => array(
    				'id',
    				true,
    			),
    			'start_date' => array(
    				'added_date',
    				true,
    			),
    			'end_date' => array(
    				'end_date',
    				true,
    			),

    end_date foo tbd;-)

    • This reply was modified 1 year, 11 months ago by airdrummer. Reason: add sorting
    Thread Starter airdrummer

    (@airdrummer)

    oops, missing start_date foo…i’ll leave it to u, darrell;-)

    Plugin Author YOP

    (@yourownprogrammer)

    ?i would like to be able to sort polls on the admin page by date?

    what date are you referring to?
    we have 3 dates for polls
    – added date
    – start date (could be null if there’s no start date defined)
    – end date (could be null if there’s no end date defined)

    Thread Starter airdrummer

    (@airdrummer)

    all of them;-) id is a proxy for added date, so the start & end dates’ columns should be sortable as well, i just haven’t found the right foo/majick incantation yet;-)

    yop-poll/admin/models/polls-list.php:101-123:

    public function column_start_date( $item )
    {
    $poll_meta = unserialize( $item['meta_data'] );
    $date_format = get_option( 'date_format' );
    $time_format = get_option( 'time_format' );
    $start_date = $item['added_date'];
    if (( 'now' !== $poll_meta['options']['poll']['startDateOption'] )
    and ('' !== $poll_meta['options']['poll']['startDateCustom'] ) )
    $start_date = $poll_meta['options']['poll']['startDateCustom'];
    $item['start_date'] = strtotime($start_date);
    return date_i18n( $date_format . ' ' . $time_format, $start_date );
    }
    public function column_end_date( $item )
    {
    $poll_meta = unserialize( $item['meta_data'] );
    $date_format = get_option( 'date_format' );
    $time_format = get_option( 'time_format' );
    $item['end_date'] = $end_date = esc_html__( 'Never', 'yop-poll' );
    if (( 'never' !== $poll_meta['options']['poll']['endDateOption'] )
    and ( '' !== $poll_meta['options']['poll']['endDateCustom'] ))
    {
    $item['end_date'] = $end_date = strtotime( $poll_meta['options']['poll']['endDateCustom']);
    $end_date = date_i18n(
    $date_format . ' ' . $time_format,
    $end_date );
    }
    return $end_date;
    }
    Plugin Author YOP

    (@yourownprogrammer)

    I was afraid of this answer ??

    start date and end date are not table columns and it’s a bit trickier to order.
    but for sure it’s possible.

    Thread Starter airdrummer

    (@airdrummer)

    huh? my kludge has fubduck startdate, but there definitely are date columns;-)

    Plugin Author YOP

    (@yourownprogrammer)

    @airdrummer we will release a new version next week that will include a new column (Id)(sortable) for View Polls page and also the ability to sort based on Start Date and End Date.

    Thread Starter airdrummer

    (@airdrummer)

    why not just sort on the code column? it embeds the id…dry;-)

    Plugin Author YOP

    (@yourownprogrammer)

    sorting on the code column is doable.
    but it may cause confusion among users?

    Thread Starter airdrummer

    (@airdrummer)

    no, the code column already confuses me;-) adding the id and sorting will help…

    Plugin Author YOP

    (@yourownprogrammer)

    @airdrummer we have released a new version today that introduces sorting for both start date/end date and also some changes to the code column.

    Thread Starter airdrummer

    (@airdrummer)

    looks great thanx!-) alfho i think repeating the entire shortcode is redundant, given that the shortcode is still revealed by clicking the link, not to mention making a crowded table…but then i’m a dry guy from waaay back;-)

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘sort polls on date or id’ is closed to new replies.