WordPress Download Manager - Version 3.1.24

Version Description

  • 2021.05.01 =
  • Fixed an issue with user downoad count table creation
  • Fixed and issue with stats filtering options
Download this release

Release Info

Developer codename065
Plugin Icon 128x128 WordPress Download Manager
Version 3.1.24
Comparing to
See all releases

Code changes from version 3.1.23 to 3.1.24

admin/menus/class.Stats.php CHANGED
@@ -15,17 +15,19 @@ class Stats
15
  {
16
  function __construct()
17
  {
18
- add_action('admin_menu', array($this, 'Menu'));
19
- add_action('admin_init', array($this, 'Export'));
 
 
20
  }
21
 
22
- function Menu()
23
  {
24
  $menu_access_cap = apply_filters('wpdm_admin_menu_stats', WPDM_MENU_ACCESS_CAP);
25
  add_submenu_page('edit.php?post_type=wpdmpro', __('History ‹ Download Manager','download-manager'), __('History','download-manager'), $menu_access_cap, 'wpdm-stats', array($this, 'UI'));
26
  }
27
 
28
- function Export(){
29
  if(wpdm_query_var('page') == 'wpdm-stats' && wpdm_query_var('task') == 'export'){
30
  global $wpdb;
31
  $adcond = array();
@@ -43,10 +45,53 @@ class Stats
43
  }
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  function UI()
47
  {
48
  include(WPDM_BASE_DIR."admin/tpls/stats.php");
49
  }
50
 
51
 
52
- }
15
  {
16
  function __construct()
17
  {
18
+ add_action('admin_menu', array($this, 'menu'));
19
+ add_action('admin_init', array($this, 'export'));
20
+ add_action('wp_ajax_wpdm_stats_get_packages', array($this, 'ajax_callback_get_packages'));
21
+ add_action('wp_ajax_wpdm_stats_get_users', array($this, 'ajax_callback_get_users'));
22
  }
23
 
24
+ function menu()
25
  {
26
  $menu_access_cap = apply_filters('wpdm_admin_menu_stats', WPDM_MENU_ACCESS_CAP);
27
  add_submenu_page('edit.php?post_type=wpdmpro', __('History ‹ Download Manager','download-manager'), __('History','download-manager'), $menu_access_cap, 'wpdm-stats', array($this, 'UI'));
28
  }
29
 
30
+ function export(){
31
  if(wpdm_query_var('page') == 'wpdm-stats' && wpdm_query_var('task') == 'export'){
32
  global $wpdb;
33
  $adcond = array();
45
  }
46
  }
47
 
48
+ public function ajax_callback_get_packages()
49
+ {
50
+ global $wpdb;
51
+ $posts_table = "{$wpdb->prefix}posts";
52
+ $packages = [];
53
+ $term = isset($_GET['term']) ? $_GET['term'] : null;
54
+
55
+ if ($term) {
56
+ $result_rows = $wpdb->get_results("SELECT ID, post_title FROM $posts_table where `post_type` = 'wpdmpro' AND `post_title` LIKE '%" . $term . "%' ");
57
+ foreach ($result_rows as $row) {
58
+ array_push($packages, [
59
+ 'id' => $row->ID,
60
+ 'text' => $row->post_title
61
+ ]);
62
+ }
63
+ }
64
+ //results key is necessary for jquery select2
65
+ wp_send_json(["results" => $packages]);
66
+ }
67
+
68
+ public function ajax_callback_get_users()
69
+ {
70
+ global $wpdb;
71
+ $users_table = "{$wpdb->prefix}users";
72
+ $term = isset($_GET['term']) ? $_GET['term'] : null;
73
+ $users = [];
74
+
75
+ if ($term) {
76
+ $result_rows = $wpdb->get_results("SELECT ID, user_login, display_name, user_email FROM $users_table where `display_name` LIKE '%" . $term . "%' OR `user_login` LIKE '%" . $term . "%' OR `user_email` LIKE '%" . $term . "%' ");
77
+ foreach ($result_rows as $row) {
78
+ $text = $row->display_name . " ( $row->user_login ) ";
79
+ array_push($users, [
80
+ 'id' => $row->ID,
81
+ 'text' => $text
82
+ ]);
83
+ }
84
+ }
85
+ //results key is necessary for jquery select2
86
+ wp_send_json(["results" => $users]);
87
+ }
88
+
89
+
90
+
91
  function UI()
92
  {
93
  include(WPDM_BASE_DIR."admin/tpls/stats.php");
94
  }
95
 
96
 
97
+ }
download-manager.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Download Manager
4
  Plugin URI: https://www.wpdownloadmanager.com/pricing/
5
  Description: Manage, Protect and Track file downloads, and sell digital products from your WordPress site. A complete digital asset management solution.
6
  Author: W3 Eden
7
- Version: 3.1.23
8
  Author URI: https://www.wpdownloadmanager.com/
9
  Text Domain: download-manager
10
  Domain Path: /languages
@@ -108,7 +108,7 @@ class WordPressDownloadManager{
108
 
109
  function __construct(){
110
 
111
- define('WPDM_Version','3.1.23');
112
 
113
  register_activation_hook(__FILE__, array($this, 'Install'));
114
 
4
  Plugin URI: https://www.wpdownloadmanager.com/pricing/
5
  Description: Manage, Protect and Track file downloads, and sell digital products from your WordPress site. A complete digital asset management solution.
6
  Author: W3 Eden
7
+ Version: 3.1.24
8
  Author URI: https://www.wpdownloadmanager.com/
9
  Text Domain: download-manager
10
  Domain Path: /languages
108
 
109
  function __construct(){
110
 
111
+ define('WPDM_Version','3.1.24');
112
 
113
  register_activation_hook(__FILE__, array($this, 'Install'));
114
 
libs/class.Installer.php CHANGED
@@ -12,20 +12,17 @@ if (!class_exists('\WPDM\Installer')):
12
  class Installer
13
  {
14
 
15
- private $dbVersion = 311.6;
16
-
17
  function __construct()
18
  {
19
 
20
  }
21
 
22
  public static function dbVersion(){
23
- $inst = new Installer();
24
- return $inst->dbVersion;
25
  }
26
 
27
  public static function dbUpdateRequired(){
28
- return (Installer::dbVersion() !== (double)get_option('__wpdm_db_version'));
29
  }
30
 
31
  public static function init(){
@@ -111,7 +108,7 @@ if (!class_exists('\WPDM\Installer')):
111
  PRIMARY KEY (`ID`)
112
  )";
113
 
114
- $sqls[] = "CREATE TABLE IF EXISTS `{$wpdb->prefix}ahm_user_download_counts` (
115
  `ID` int(11) NOT NULL AUTO_INCREMENT,
116
  `user` varchar(255) NOT NULL,
117
  `package_id` int(11) NOT NULL,
@@ -135,7 +132,7 @@ if (!class_exists('\WPDM\Installer')):
135
  $ach = maybe_unserialize($ach);
136
  $ach[] = time();
137
  update_option("__wpdm_activation_history", $ach);
138
- update_option('__wpdm_db_version', $installer->dbVersion);
139
 
140
  }
141
 
12
  class Installer
13
  {
14
 
 
 
15
  function __construct()
16
  {
17
 
18
  }
19
 
20
  public static function dbVersion(){
21
+ return WPDM_Version;
 
22
  }
23
 
24
  public static function dbUpdateRequired(){
25
+ return (WPDM_Version !== (double)get_option('__wpdm_db_version'));
26
  }
27
 
28
  public static function init(){
108
  PRIMARY KEY (`ID`)
109
  )";
110
 
111
+ $sqls[] = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ahm_user_download_counts` (
112
  `ID` int(11) NOT NULL AUTO_INCREMENT,
113
  `user` varchar(255) NOT NULL,
114
  `package_id` int(11) NOT NULL,
132
  $ach = maybe_unserialize($ach);
133
  $ach[] = time();
134
  update_option("__wpdm_activation_history", $ach);
135
+ update_option('__wpdm_db_version', WPDM_Version);
136
 
137
  }
138
 
readme.txt CHANGED
@@ -181,6 +181,10 @@ Check download stats and get a push notification when someone downloads, install
181
 
182
  == Changelog ==
183
 
 
 
 
 
184
  = 3.1.23 - 2021.04.27 =
185
  * Improved asset manager
186
 
181
 
182
  == Changelog ==
183
 
184
+ = 3.1.24 - 2021.05.01 =
185
+ * Fixed an issue with user downoad count table creation
186
+ * Fixed and issue with stats filtering options
187
+
188
  = 3.1.23 - 2021.04.27 =
189
  * Improved asset manager
190