WordPress.org

Forums

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

YOP Poll
[resolved] Poll ID don't appear in " All polls ", french, Yop Poll 4.9.1 (9 posts)

  1. FWillette
    Member
    Posted 2 years ago #

    Hello
    Using Yop Poll 4.9.1 within WP 3.9.1, french versions, the poll ID don't appear in the table of "All Polls "
    Not very important ( ID appear in poll edit ) but I miss it when there are many polls. Polls being listed in alphabetic ordre.

    Thank's

    frédy

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

  2. YOP
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Frédy,

    Edit admin.php and in view_all_polls() function, in <thead> and <tfoot> add

    <th id="id"
                                                class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
                                                style="width: 5%" scope="col"><a
                                                    href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'id' => $order_direction['id'] ) ) ); ?>">
                <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
                                                        class="sorting-indicator"></span>
               </a></th>

    and in <tbody> add

    <td><strong>
                                                                    <?php echo esc_html( stripslashes( $yop_poll['id'] ) ); ?>
                 </strong><br></td>

    Make sure you add them after the checkboxes. In the end, you should have

    public function view_all_polls() {
       global $page, $action, $orderby, $order, $current_user;
       $orderby                    = ( empty ( $orderby ) ) ? 'name' : $orderby;
       $order_direction            = array( 'id' => 'asc', 'name' => 'asc', 'question' => 'asc', 'start_date' => 'asc', 'end_date' => 'asc', 'total_votes' => 'asc', 'total_answers' => 'asc' );
       $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
    
       $order_direction_reverse            = array( 'id' => 'desc', 'name' => 'desc', 'question' => 'desc', 'start_date' => 'desc', 'end_date' => 'desc', 'total_votes' => 'desc', 'total_answers' => 'desc' );
       $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
    
       $order_sortable            = array( 'id' => 'sortable', 'name' => 'sortable', 'question' => 'sortable', 'start_date' => 'sortable', 'end_date' => 'sortable', 'total_votes' => 'sortable', 'total_answers' => 'sortable' );
       $order_sortable [$orderby] = 'sorted';
       require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
       $filter = array( 'field' => NULL, 'value' => NULL, 'operator' => '=' );
       if ( isset ( $_REQUEST ['filters'] ) ){
        switch ( $_REQUEST ['filters'] ) {
         case 'started' :
          $filter = array( 'field' => 'start_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '<=' );
          break;
         case 'not_started' :
          $filter = array( 'field' => 'start_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '>=' );
          break;
         case 'never_expire' :
          $filter = array( 'field' => 'end_date', 'value' => '9999-12-31 23:59:59', 'operator' => '=' );
          break;
         case 'expired' :
          $filter = array( 'field' => 'end_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '<=' );
          break;
        }
       }
       $search                  = array(
        'fields' => array( 'name', 'question' ),
        'value'  => isset ( $_REQUEST ['s'] ) ? $_REQUEST ['s'] : ''
       );
       $yop_polls               = Yop_Poll_Model::get_yop_polls_filter_search( $orderby, $order, $filter, $search );
       $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
       $optin_box_modal_query   = admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) );
       $optin_box_modal_query   = add_query_arg( 'action', 'yop_poll_show_optin_box_modal', $optin_box_modal_query );
      ?>
      <?php if ( $optin_box_modal_options['show'] == 'yes' ){ ?>
       <a id="yop-poll-show-modal-box"
        href="<?php echo $optin_box_modal_query; ?>" style="display: none;"></a>
       <?php } ?>
      <div class="wrap">
       <div class="icon32 icon32-yop-poll">
        <br>
    
       </div>
       <h2><?php _e( 'Yop Poll', 'yop_poll' ); ?><a class="add-new-h2"
         href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-add-new', 'id' => false, 'deleted' => false, 'cloned' => false ) ) ); ?>"><?php _e( 'Add New', 'yop_poll' ); ?></a>
       </h2>
       <?php
        if ( isset ( $_REQUEST ['deleted'] ) ){
         echo '<div id="message" class="updated"><p>';
         $deleted = ( int )$_REQUEST ['deleted'];
         printf( _n( '%s Poll deleted.', '%s Polls deleted.', $deleted ), $deleted );
         echo '</p></div>';
         $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
        }
       ?>
       <?php
        if ( isset ( $_REQUEST ['cloned'] ) ){
         echo '<div id="message" class="updated"><p>';
         $cloned = ( int )$_REQUEST ['cloned'];
         printf( _n( '%s Poll cloned.', '%s Polls cloned.', $cloned ), $cloned );
         echo '</p></div>';
         $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'cloned' ), $_SERVER ['REQUEST_URI'] );
        }
       ?>
       <?php
        if ( isset ( $_REQUEST ['reseted_votes'] ) ){
         echo '<div id="message" class="updated"><p>';
         $reseted_votes = ( int )$_REQUEST ['reseted_votes'];
         printf( _n( 'Vote reseted for %s Poll.', 'Votes reseted for %s Poll.', $reseted_votes ), $reseted_votes );
         echo '</p></div>';
         $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'reseted_votes' ), $_SERVER ['REQUEST_URI'] );
        }
       ?>
    
       <?php
        if ( isset ( $_REQUEST ['deleted_logs'] ) ){
         echo '<div id="message" class="updated"><p>';
         $deleted_logs = ( int )$_REQUEST ['deleted_logs'];
         printf( _n( 'Log deleted for %s Poll.', 'Log deleted for %s Polls.', $deleted_logs ), $deleted_logs );
         echo '</p></div>';
         $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted_logs' ), $_SERVER ['REQUEST_URI'] );
        }
       ?>
    
       <div id="poststuff">
        <div id="post-body" class="metabox-holder columns-2">
         <form action="" method="get">
          <div id="post-body-content">
           <?php wp_nonce_field( 'yop-poll-view' ); ?>
           <input type="hidden" name="order" value="<?php echo $order ?>"/>
           <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
           <input type="hidden" name="page" value="yop-polls"/>
           <p class="search-box">
            <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Polls', 'yop_poll' ) ?></label>
            <input id="yop-poll-search-input" type="search"
             value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
             name="s"/> <input id="search-submit" class="button"
             type="submit" value="<?php _e( 'Search Polls', 'yop_poll' ); ?>"
             name=""/>
           </p>
           <div class="tablenav top">
            <div class="alignleft actions">
             <select name="action">
              <option selected="selected" value="-1"><?php _e( 'Bulk Actions', 'yop_poll' ); ?></option>
              <option value="delete"><?php _e( 'Delete', 'yop_poll' ); ?></option>
              <option value="clone"><?php _e( 'Clone', 'yop_poll' ); ?></option>
              <option value="reset_votes"><?php _e( 'Reset Votes', 'yop_poll' ); ?></option>
              <option value="delete_logs"><?php _e( 'Delete Logs', 'yop_poll' ); ?></option>
             </select>
             <input type="submit"
              value="<?php _e( 'Apply', 'yop_poll' ); ?>"
              class="button-secondary action" id="doaction" name="">
            </div>
            <div class="alignleft actions">
             <select name="filters">
              <option value="0"><?php _e( 'View All Polls', 'yop_poll' ); ?></option>
              <option
               <?php echo isset( $_REQUEST['filters'] ) ? ( 'never_expire' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
               value="never_expire"><?php _e( 'No end date', 'yop_poll' ); ?></option>
              <option
               <?php echo isset( $_REQUEST['filters'] ) ? ( 'expired' == $_REQUEST..

    Regards,

    YOP Team

  3. FWillette
    Member
    Posted 2 years ago #

    Hi

    Thank you for responding so rapidly, but could you tell me in witch directory, or elsewhere, I can find the admin.php file?
    The file I found with this name didn't seem to be the good one.

    Best regards,

    Frédy

  4. YOP
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Frédym

    From your WordPress menu, go to Plugins -> Installed Plugins and Edit Yop Poll Plugin.

    On the right hand side you have a list with your Plugin Files. Scroll down and open yop-poll/inc/admin.php

    Please let us know if you need more help.

    Best wishes,

    YOP Team

  5. FWillette
    Member
    Posted 2 years ago #

    Hi

    I think I am in progress. I found the yop-poll/inc/admin.php file and open it, but I am not able to find the view_all_polls() function; neither in the edit window, nor in the drop down list of Documentation under the edit window.

    Could you guide me a little bit farer, otherway it will stay in the state.

    In ethery case, thanks a lot for all.

    Frédy

  6. FWillette
    Member
    Posted 2 years ago #

    Hi

    I progressed a bit more.
    I found the view_all_polls() function, and even <thead> and <tfoot>.
    For <tbody>, I'm note sure, an i don't realy see where ti add the lines you sent me. You example ends at:

    <?php echo isset( $_REQUEST['filters'] ) ? ( 'expired' == $_REQUEST..

    maybe is it too short.

    I apologise for my poor knowledges in programming such things.

    Thanks for all.

    Frédy

  7. FWillette
    Member
    Posted 2 years ago #

    Hi again

    One step more. I added the line in <thead> and <tfoot> between
    "id" an "name". I found <tbody id="the-list"> twice but I don't know if it is the right place; there is well a </tbody> .

    The result now is that all strings in the table are shifted one column left. Hope we will solve it.

    Best regards

    Frédy

  8. YOP
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Frédy,

    Please email us at yop.help (@] gmail.com and we will provide a .txt file that includes the code with all the modifications.

    Regards,

    YOP Team

  9. FWillette
    Member
    Posted 2 years ago #

    Hi

    This issue in resolved.
    View all polls ( french version) works now correctly.

    Thanks a lot for your support

    Frédy

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags