Plugin Directory

Changeset 3279485


Ignore:
Timestamp:
04/23/2025 12:08:44 AM (11 months ago)
Author:
etruel
Message:

Recommended Upgrade to all users

Location:
wpecounter
Files:
28 added
4 edited

Legend:

Unmodified
Added
Removed
  • wpecounter/trunk/includes/class-views.php

    r2789038 r3279485  
    295295        public function views_column_orderby($query) {
    296296            global $pagenow, $post_type;
     297            if ('edit.php' !== $pagenow || !is_admin() || !$query->is_main_query()) {
     298                return;
     299            }
     300
    297301            $orderby = $query->get('orderby');
    298 //          if ('edit.php' != $pagenow || empty($orderby) )
    299 //              return;
    300             switch ($orderby) {
    301                 case 'post_views':
    302 
    303                     $query->set('meta_query', array(
    304                         'sort_column'    => 'post_views',
    305                         'relation'       => 'OR',
    306                         'views_clause'   => array(
    307                             'key'    => $this->wpecounter_views_meta_key(),
    308                             'type'   => 'numeric'
    309                         ),
    310                         'noviews_clause' => array(
    311                             'key'        => $this->wpecounter_views_meta_key(),
    312                             'compare'    => 'NOT EXISTS'
    313                         )
    314                     ));
    315 
    316 //                  $query->set('meta_key', $this->wpecounter_views_meta_key() );
    317 //                  $query->set('meta_type', 'NUMERIC');
    318 //                  $query->set('suppress_filters', false);
    319 //                  $query->set('hide_empty', false);
     302            $order = strtoupper($query->get('order')) === 'ASC' ? 'ASC' : 'DESC'; // Default to DESC if not set
     303
     304            if ('post_views' === $orderby) {
     305                $query->set('meta_query', array(
     306                    'relation'       => 'OR',
     307                    'views_clause'   => array(
     308                        'key'    => $this->wpecounter_views_meta_key(),
     309                        'type'   => 'numeric'
     310                    ),
     311                    'noviews_clause' => array(
     312                        'key'        => $this->wpecounter_views_meta_key(),
     313                        'compare'    => 'NOT EXISTS',
     314                        'type'   => 'numeric'
     315                    )
     316                ));
     317
     318                if($order == 'DESC'){
     319                    $query->set('orderby', 'noviews_clause');
     320                }else{
    320321                    $query->set('orderby', 'meta_value_num');
    321 
    322                     break;
    323 
    324                 default:
    325                     break;
     322                }
    326323            }
    327324        }
  • wpecounter/trunk/includes/plugin-utils.php

    r2781621 r3279485  
    124124                }
    125125            }
    126             delete_option(self :: OPTION_KEY);
     126            delete_option('WPeCounter_Options');
    127127        }
    128128
  • wpecounter/trunk/readme.txt

    r3096106 r3279485  
    11=== WP Views Counter ===
    2 Contributors: etruel, khaztiel
     2Contributors: etruel, khaztiel, gerarjos14
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7267TH4PT3GSW
    44Tags: views, count visits, post views, post visits, ajax counter
    55Requires at least: 3.1
    6 Tested up to: 6.5.4
     6Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 2.0.2
     8Stable tag: 2.0.3
    99License: GPLv2
    1010
     
    6464== Changelog ==
    6565
     66= 2.0.3 - Apr 22, 2025 =
     67> * Fixed incorrect posts order when clicking on the Views column header.
     68> * Fixed a fatal error occurring during plugin uninstallation.
     69> * Bump to WP 6.8
     70
    6671= 2.0.2 - Jun 01, 2024 =
    6772* Bump to WP 6.5.4
     
    108113
    109114== Upgrade Notice ==
    110 1. Major Upgrade.
     1151. Recommended Upgrade.
  • wpecounter/trunk/wpecounter.php

    r3096106 r3279485  
    44 * Plugin URI:   https://etruel.com/downloads/wpecounter
    55 * Description:  Counts visits on post lists, pages and/or custom post types. It also displays them in posts, pages or text widget content, shortcode [WPeCounter].
    6  * Version:      2.0.2
     6 * Version:      2.0.3
    77 * Author:       Etruel Developments LLC
    88 * Author URI:   https://etruel.com
     
    1515// Plugin version
    1616if (!defined('WPECOUNTER_VERSION'))
    17     define('WPECOUNTER_VERSION', '2.0.2');
     17    define('WPECOUNTER_VERSION', '2.0.3');
    1818
    1919if (!class_exists('WPeCounter')) :
Note: See TracChangeset for help on using the changeset viewer.