• Resolved faye109

    (@faye109)


    I updated to version 5.2 this morning, and the poll appearing on my homepage is now the default ‘How is my plugin?’ poll instead of my latest poll. I’m using the ‘latest poll’ shortcode [yop_poll id=”-2″] called into my template with do_shortcode so it looks like the shortcode isn’t working in the latest version.

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

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

    (@yourownprogrammer)

    Hello

    Thank you for your feedback.

    We were able to identify the problem and fix it.

    It’s going to take a couple more days to release a new version that contains the fix so I have included the fix below

    In plugin editor, edit abstract_model.php under models folder

    look for the line below

    __construct( $id = 0, $is_view_results = "no", $question_sort = "poll_order", $question_sort_rule = "ASC", $answer_sort = "question_order", $answer_sort_rule = "ASC" )

    and replace this code

    if($id=="-2"){
    
    	$filters   = array();
    	$filters[] = array(
    		'field'    => 'poll_type',
    		'value'    => 'poll',
    		'operator' => '='
    	);
    
    	$filters[] = array(
    		'field'    => 'poll_start_date',
    		'value'    => current_time( 'mysql' ),
    		'operator' => '<='
    	);
    
    	$args = array(
    		'return_fields' => 'ID ',
    		'filters'       => $filters,
    		'search'        => array(
    
    		),
    		'orderby'       => "poll_start_date",
    		'order'         => 'DESC'
    	);
    
    	$total_polls = Yop_Poll_Model::get_polls_filter_search( $args );
    	$id=$total_polls[count($total_polls)-1]['ID'] ;
    }

    with this one

    if($id=="-2"){
    
    	$filters   = array();
    	$filters[] = array(
    		'field'    => 'poll_type',
    		'value'    => 'poll',
    		'operator' => '='
    	);
    
    	$filters[] = array(
    		'field'    => 'poll_start_date',
    		'value'    => current_time( 'mysql' ),
    		'operator' => '<='
    	);
    
    	$args = array(
    		'return_fields' => 'ID ',
    		'filters'       => $filters,
    		'search'        => array(
    
    		),
    		'orderby'       => "poll_date",
    		'order'         => 'ASC'
    	);
    
    	$total_polls = Yop_Poll_Model::get_polls_filter_search( $args );
    	$id=$total_polls[count($total_polls)-1]['ID'] ;
    }

    Please let us know if that fixes your problem.

    Best
    YOP Team

    Thread Starter faye109

    (@faye109)

    That looks like it’s fixed it – thank you!

    Plugin Author YOP

    (@yourownprogrammer)

    That’s great.

    Thank you for your feedback.

    Best
    YOP Team

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Updated to 5.2, latest poll shortcode not working’ is closed to new replies.