Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi,

    this happens because of the wrong ID, if you have deleted a poll before.
    Perhaps you shouldn´t get the poll item by rand over all items.

    i have changed the code in abstract_model.php (line: 131+) from:

    if( count($total_polls)>1)  {
      while($ok==0){
        $id=rand ( 1 , count($total_polls));
        $poll=new YOP_POLL_Poll_Model($id);
        if( $current_date <= convert_date( $poll->poll_end_date, 'Y-m-d H:i:s' ) ) {
          $ok=1;
        }
      }
    }

    to this:

    if(count($total_polls)>1)  {
      while($ok==0){
        $randomPollId = array_rand ($total_polls);
        $id = $total_polls[$randomPollId]['ID'];
        $poll=new YOP_POLL_Poll_Model($id);
        if( $current_date <= convert_date( $poll->poll_end_date, 'Y-m-d H:i:s' ) ) {
          $ok=1;
        }
      }
    }

Viewing 1 replies (of 1 total)