Simple Download Monitor - Version 3.7.9.1

Version Description

  • Improved the after login redirection feature so it is compatible with login via wp-login.php.
  • Added a new filter hook.
Download this release

Release Info

Developer mra13
Plugin Icon 128x128 Simple Download Monitor
Version 3.7.9.1
Comparing to
See all releases

Code changes from version 3.7.8 to 3.7.9.1

includes/sdm-admin-menu-handler.php CHANGED
@@ -183,6 +183,15 @@ function sdm_admin_menu_general_settings() {
183
  ?>
184
  <!-- END GENERAL OPTIONS DIV -->
185
 
 
 
 
 
 
 
 
 
 
186
 
187
  <!-- BEGIN ADMIN OPTIONS DIV -->
188
  <?php
183
  ?>
184
  <!-- END GENERAL OPTIONS DIV -->
185
 
186
+ <!-- BEGIN USER LOGIN OPTIONS DIV -->
187
+ <?php
188
+ // This prints out all hidden setting fields
189
+ do_settings_sections( 'user_login_options_section' );
190
+ settings_fields( 'sdm_downloads_options' );
191
+
192
+ submit_button();
193
+ ?>
194
+ <!-- END USER LOGIN OPTIONS DIV -->
195
 
196
  <!-- BEGIN ADMIN OPTIONS DIV -->
197
  <?php
includes/sdm-download-request-handler.php CHANGED
@@ -62,8 +62,18 @@ function handle_sdm_download_via_direct_post() {
62
  $loginMsg = '';
63
  if ( isset( $main_option[ 'general_login_page_url' ] ) && ! empty( $main_option[ 'general_login_page_url' ] ) ) {
64
  //We have a login page URL set. Lets use it.
65
- $tpl = __( "__Click here__ to go to login page.", 'simple-download-monitor' );
66
- $loginMsg = preg_replace( '/__(.*)__/', ' <a href="' . $main_option[ 'general_login_page_url' ] . '">$1</a> $2', $tpl );
 
 
 
 
 
 
 
 
 
 
67
  }
68
  wp_die( __( 'You need to be logged in to download this file.', 'simple-download-monitor' ) . $loginMsg );
69
  }
62
  $loginMsg = '';
63
  if ( isset( $main_option[ 'general_login_page_url' ] ) && ! empty( $main_option[ 'general_login_page_url' ] ) ) {
64
  //We have a login page URL set. Lets use it.
65
+
66
+ if ( isset( $main_option[ 'redirect_user_back_to_download_page' ] ) ) {
67
+ //Redirect to download page after login feature is enabled.
68
+ $dl_post_url = get_permalink( $download_id );//The single download item page
69
+ $redirect_url = apply_filters('sdm_after_login_redirect_query_arg', $dl_post_url);
70
+ $login_page_url = add_query_arg( array( 'sdm_redirect_to' => urlencode($redirect_url) ), $main_option[ 'general_login_page_url' ] );
71
+ } else {
72
+ $login_page_url = $main_option[ 'general_login_page_url' ];
73
+ }
74
+
75
+ $tpl = __( "__Click here__ to go to login page.", 'simple-download-monitor' );
76
+ $loginMsg = preg_replace( '/__(.*)__/', ' <a href="' . $login_page_url . '">$1</a> $2', $tpl );
77
  }
78
  wp_die( __( 'You need to be logged in to download this file.', 'simple-download-monitor' ) . $loginMsg );
79
  }
includes/sdm-user-login-related.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Handles the after login redirect if standard wordpress's user login is being used with this feature.
5
+ */
6
+ function sdm_after_wp_user_login_redirect( $redirect_to, $request, $user ) {
7
+ if(isset($_REQUEST['sdm_redirect_to']) && !empty($_REQUEST['sdm_redirect_to'])){
8
+ //Check if the "redirect_user_back_to_download_page" feature is enabled on this site.
9
+ $main_option = get_option( 'sdm_downloads_options' );
10
+ if ( isset( $main_option[ 'redirect_user_back_to_download_page' ] ) ) {
11
+ $redirect_to = urldecode($_REQUEST['sdm_redirect_to']);
12
+ }
13
+ }
14
+ return $redirect_to;
15
+ }
16
+ add_filter( 'login_redirect', 'sdm_after_wp_user_login_redirect', 10, 3 );
17
+
18
+ /*
19
+ * Handles the redirect in some other situation (example: a plugin is being used for user management/membership system).
20
+ */
21
+ function sdm_check_redirect_query_and_settings(){
22
+
23
+ if(isset($_REQUEST['sdm_redirect_to']) && !empty($_REQUEST['sdm_redirect_to'])){
24
+ //Check if the "redirect_user_back_to_download_page" feature is enabled on this site.
25
+ $main_option = get_option( 'sdm_downloads_options' );
26
+ if ( isset( $main_option[ 'redirect_user_back_to_download_page' ] ) ) {
27
+ //Check if the user is logged-in (since we only want to redirect a logged-in user.
28
+ $visitor_name = sdm_get_logged_in_user();
29
+ if ($visitor_name !== false ) {
30
+ $redirect_url = urldecode($_REQUEST['sdm_redirect_to']);
31
+ wp_safe_redirect( $redirect_url );//user wp safe redirect.
32
+ exit;
33
+ }
34
+ }
35
+ }
36
+ }
includes/sdm-utility-functions.php CHANGED
@@ -303,9 +303,34 @@ function sdm_get_default_download_button_text( $download_id ) {
303
  }
304
 
305
  /*
306
- * Use this function to redirect to a URL
307
  */
 
 
 
 
 
 
 
 
308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  function sdm_redirect_to_url( $url, $delay = '0', $exit = '1' ) {
310
  $url = apply_filters( 'sdm_before_redirect_to_url', $url );
311
  if ( empty( $url ) ) {
303
  }
304
 
305
  /*
306
+ * Use this function to read the current page's URL
307
  */
308
+ function sdm_get_current_page_url() {
309
+ $page_url = 'http';
310
+
311
+ if (isset($_SERVER['SCRIPT_URI']) && !empty($_SERVER['SCRIPT_URI'])) {
312
+ $page_url = $_SERVER['SCRIPT_URI'];
313
+ $page_url = apply_filters('sdm_get_current_page_url', $page_url);
314
+ return $page_url;
315
+ }
316
 
317
+ if (isset($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) {
318
+ $page_url .= "s";
319
+ }
320
+ $page_url .= "://";
321
+ if (isset($_SERVER["SERVER_PORT"]) && ($_SERVER["SERVER_PORT"] != "80")) {
322
+ $page_url .= ltrim($_SERVER["SERVER_NAME"], ".*") . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
323
+ } else {
324
+ $page_url .= ltrim($_SERVER["SERVER_NAME"], ".*") . $_SERVER["REQUEST_URI"];
325
+ }
326
+
327
+ $page_url = apply_filters('sdm_get_current_page_url', $page_url);
328
+ return $page_url;
329
+ }
330
+
331
+ /*
332
+ * Use this function to redirect to a URL
333
+ */
334
  function sdm_redirect_to_url( $url, $delay = '0', $exit = '1' ) {
335
  $url = apply_filters( 'sdm_before_redirect_to_url', $url );
336
  if ( empty( $url ) ) {
main.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Download Monitor
4
  * Plugin URI: https://simple-download-monitor.com/
5
  * Description: Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
6
- * Version: 3.7.8
7
  * Author: Tips and Tricks HQ, Ruhul Amin, Josh Lobe
8
  * Author URI: https://www.tipsandtricks-hq.com/development-center
9
  * License: GPL2
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
17
- define( 'WP_SIMPLE_DL_MONITOR_VERSION', '3.7.8' );
18
  define( 'WP_SIMPLE_DL_MONITOR_DIR_NAME', dirname( plugin_basename( __FILE__ ) ) );
19
  define( 'WP_SIMPLE_DL_MONITOR_URL', plugins_url( '', __FILE__ ) );
20
  define( 'WP_SIMPLE_DL_MONITOR_PATH', plugin_dir_path( __FILE__ ) );
@@ -29,6 +29,7 @@ include_once('includes/sdm-debug.php');
29
  include_once('includes/sdm-utility-functions.php');
30
  include_once('includes/sdm-utility-functions-admin-side.php');
31
  include_once('includes/sdm-download-request-handler.php');
 
32
  include_once('includes/sdm-logs-list-table.php');
33
  include_once('includes/sdm-latest-downloads.php');
34
  include_once('includes/sdm-popular-downloads.php');
@@ -81,6 +82,7 @@ function sdm_plugins_loaded_tasks() {
81
 
82
  //Handle db upgrade stuff
83
  sdm_db_update_check();
 
84
  }
85
 
86
  /*
@@ -92,6 +94,10 @@ add_action( 'admin_init', 'sdm_admin_init_time_tasks' );
92
  function sdm_init_time_tasks() {
93
  //Handle download request if any
94
  handle_sdm_download_via_direct_post();
 
 
 
 
95
  if ( is_admin() ) {
96
  //Register Google Charts library
97
  wp_register_script( 'sdm_google_charts', 'https://www.gstatic.com/charts/loader.js', array(), null, true );
@@ -386,15 +392,24 @@ class simpleDownloadManager {
386
 
387
  //Check the sdm_item_disable_single_download_page value
388
  $sdm_item_disable_single_download_page = get_post_meta( $post->ID, 'sdm_item_disable_single_download_page', true );
 
389
 
390
  echo '<p> <input id="sdm_item_new_window" type="checkbox" name="sdm_item_new_window" value="yes"' . checked( true, $new_window, false ) . ' />';
391
  echo '<label for="sdm_item_new_window">' . __( 'Open download in a new window.', 'simple-download-monitor' ) . '</label> </p>';
392
 
 
 
 
 
 
 
 
 
393
  echo '<p> <input id="sdm_item_disable_single_download_page" type="checkbox" name="sdm_item_disable_single_download_page" value="yes"' . checked( true, $sdm_item_disable_single_download_page, false ) . ' />';
394
  echo '<label for="sdm_item_disable_single_download_page">';
395
- $disable_single_dl_label = __( 'Disable the Single Download Page for This Download Item. ', 'simple-download-monitor' );
396
  $disable_single_dl_label .= __( 'This can be useful if you are using an addon like the ', 'simple-download-monitor' );
397
- $disable_single_dl_label .= '<a href="https://simple-download-monitor.com/squeeze-form-addon-for-simple-download-monitor/" target="_blank">Squeeze Form</a>';
398
  echo $disable_single_dl_label . '</label>';
399
  echo '</p>';
400
 
@@ -577,10 +592,12 @@ class simpleDownloadManager {
577
  }
578
  // Get POST-ed data as boolean value
579
  $new_window_open = filter_input( INPUT_POST, 'sdm_item_new_window', FILTER_VALIDATE_BOOLEAN );
 
580
  $sdm_item_disable_single_download_page = filter_input( INPUT_POST, 'sdm_item_disable_single_download_page', FILTER_VALIDATE_BOOLEAN );
581
-
582
  //Save the data
583
  update_post_meta( $post_id, 'sdm_item_new_window', $new_window_open );
 
584
  update_post_meta( $post_id, 'sdm_item_disable_single_download_page', $sdm_item_disable_single_download_page );
585
  }
586
 
@@ -666,6 +683,7 @@ class simpleDownloadManager {
666
 
667
  //Add all the settings section that will go under the main settings
668
  add_settings_section( 'general_options', __( 'General Options', 'simple-download-monitor' ), array( $this, 'general_options_cb' ), 'general_options_section' );
 
669
  add_settings_section( 'admin_options', __( 'Admin Options', 'simple-download-monitor' ), array( $this, 'admin_options_cb' ), 'admin_options_section' );
670
 
671
  add_settings_section( 'sdm_colors', __( 'Colors', 'simple-download-monitor' ), array( $this, 'sdm_colors_cb' ), 'sdm_colors_section' );
@@ -675,9 +693,11 @@ class simpleDownloadManager {
675
  //Add all the individual settings fields that goes under the sections
676
  add_settings_field( 'general_hide_donwload_count', __( 'Hide Download Count', 'simple-download-monitor' ), array( $this, 'hide_download_count_cb' ), 'general_options_section', 'general_options' );
677
  add_settings_field( 'general_default_dispatch_value', __( 'PHP Dispatching', 'simple-download-monitor' ), array( $this, 'general_default_dispatch_value_cb' ), 'general_options_section', 'general_options' );
678
- add_settings_field( 'only_logged_in_can_download', __( 'Only Allow Logged-in Users to Download', 'simple-download-monitor' ), array( $this, 'general_only_logged_in_can_download_cb' ), 'general_options_section', 'general_options' );
679
- add_settings_field( 'general_login_page_url', __( 'Login Page URL', 'simple-download-monitor' ), array( $this, 'general_login_page_url_cb' ), 'general_options_section', 'general_options' );
680
-
 
 
681
  add_settings_field( 'admin_tinymce_button', __( 'Remove Tinymce Button', 'simple-download-monitor' ), array( $this, 'admin_tinymce_button_cb' ), 'admin_options_section', 'admin_options' );
682
  add_settings_field( 'admin_log_unique', __( 'Log Unique IP', 'simple-download-monitor' ), array( $this, 'admin_log_unique' ), 'admin_options_section', 'admin_options' );
683
  add_settings_field( 'admin_do_not_capture_ip', __( 'Do Not Capture IP Address', 'simple-download-monitor' ), array( $this, 'admin_do_not_capture_ip' ), 'admin_options_section', 'admin_options' );
@@ -714,6 +734,11 @@ class simpleDownloadManager {
714
  _e( 'General options settings', 'simple-download-monitor' );
715
  }
716
 
 
 
 
 
 
717
  public function admin_options_cb() {
718
  //Set the message that will be shown below the admin options settings heading
719
  _e( 'Admin options settings', 'simple-download-monitor' );
@@ -792,6 +817,13 @@ class simpleDownloadManager {
792
  echo '<label for="only_logged_in_can_download">' . __( 'Enable this option if you want to allow downloads only for logged-in users. When enabled, anonymous users clicking on the download button will receive an error message.', 'simple-download-monitor' ) . '</label>';
793
  }
794
 
 
 
 
 
 
 
 
795
  public function general_login_page_url_cb() {
796
  $main_opts = get_option( 'sdm_downloads_options' );
797
  $value = isset( $main_opts[ 'general_login_page_url' ] ) ? $main_opts[ 'general_login_page_url' ] : '';
@@ -1159,7 +1191,7 @@ $main_option = get_option( 'sdm_downloads_options' );
1159
  $tiny_button_option = isset( $main_option[ 'admin_tinymce_button' ] );
1160
  if ( $tiny_button_option != true ) {
1161
 
1162
- // Okay.. we're good. Add the button.
1163
  add_action( 'init', 'sdm_downloads_tinymce_button' );
1164
 
1165
  function sdm_downloads_tinymce_button() {
3
  * Plugin Name: Simple Download Monitor
4
  * Plugin URI: https://simple-download-monitor.com/
5
  * Description: Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
6
+ * Version: 3.7.9.1
7
  * Author: Tips and Tricks HQ, Ruhul Amin, Josh Lobe
8
  * Author URI: https://www.tipsandtricks-hq.com/development-center
9
  * License: GPL2
14
  exit;
15
  }
16
 
17
+ define( 'WP_SIMPLE_DL_MONITOR_VERSION', '3.7.9.1' );
18
  define( 'WP_SIMPLE_DL_MONITOR_DIR_NAME', dirname( plugin_basename( __FILE__ ) ) );
19
  define( 'WP_SIMPLE_DL_MONITOR_URL', plugins_url( '', __FILE__ ) );
20
  define( 'WP_SIMPLE_DL_MONITOR_PATH', plugin_dir_path( __FILE__ ) );
29
  include_once('includes/sdm-utility-functions.php');
30
  include_once('includes/sdm-utility-functions-admin-side.php');
31
  include_once('includes/sdm-download-request-handler.php');
32
+ include_once('includes/sdm-user-login-related.php');
33
  include_once('includes/sdm-logs-list-table.php');
34
  include_once('includes/sdm-latest-downloads.php');
35
  include_once('includes/sdm-popular-downloads.php');
82
 
83
  //Handle db upgrade stuff
84
  sdm_db_update_check();
85
+
86
  }
87
 
88
  /*
94
  function sdm_init_time_tasks() {
95
  //Handle download request if any
96
  handle_sdm_download_via_direct_post();
97
+
98
+ //Check if the redirect option is being used
99
+ sdm_check_redirect_query_and_settings();
100
+
101
  if ( is_admin() ) {
102
  //Register Google Charts library
103
  wp_register_script( 'sdm_google_charts', 'https://www.gstatic.com/charts/loader.js', array(), null, true );
392
 
393
  //Check the sdm_item_disable_single_download_page value
394
  $sdm_item_disable_single_download_page = get_post_meta( $post->ID, 'sdm_item_disable_single_download_page', true );
395
+ $sdm_item_hide_dl_button_single_download_page = get_post_meta( $post->ID, 'sdm_item_hide_dl_button_single_download_page', true );
396
 
397
  echo '<p> <input id="sdm_item_new_window" type="checkbox" name="sdm_item_new_window" value="yes"' . checked( true, $new_window, false ) . ' />';
398
  echo '<label for="sdm_item_new_window">' . __( 'Open download in a new window.', 'simple-download-monitor' ) . '</label> </p>';
399
 
400
+ //the new window will have no download button
401
+ echo '<p> <input id="sdm_item_hide_dl_button_single_download_page" type="checkbox" name="sdm_item_hide_dl_button_single_download_page" value="yes"' . checked( true, $sdm_item_hide_dl_button_single_download_page, false ) . ' />';
402
+ echo '<label for="sdm_item_hide_dl_button_single_download_page">';
403
+
404
+ $disable_dl_button_label = __( 'Hide the download button on the single download page of this item.', 'simple-download-monitor' );
405
+ echo $disable_dl_button_label . '</label>';
406
+ echo '</p>';
407
+
408
  echo '<p> <input id="sdm_item_disable_single_download_page" type="checkbox" name="sdm_item_disable_single_download_page" value="yes"' . checked( true, $sdm_item_disable_single_download_page, false ) . ' />';
409
  echo '<label for="sdm_item_disable_single_download_page">';
410
+ $disable_single_dl_label = __( 'Disable the single download page for this download item. ', 'simple-download-monitor' );
411
  $disable_single_dl_label .= __( 'This can be useful if you are using an addon like the ', 'simple-download-monitor' );
412
+ $disable_single_dl_label .= '<a href="https://simple-download-monitor.com/squeeze-form-addon-for-simple-download-monitor/" target="_blank">Squeeze Form</a>' . '.';
413
  echo $disable_single_dl_label . '</label>';
414
  echo '</p>';
415
 
592
  }
593
  // Get POST-ed data as boolean value
594
  $new_window_open = filter_input( INPUT_POST, 'sdm_item_new_window', FILTER_VALIDATE_BOOLEAN );
595
+ $sdm_item_hide_dl_button_single_download_page = filter_input( INPUT_POST, 'sdm_item_hide_dl_button_single_download_page', FILTER_VALIDATE_BOOLEAN );
596
  $sdm_item_disable_single_download_page = filter_input( INPUT_POST, 'sdm_item_disable_single_download_page', FILTER_VALIDATE_BOOLEAN );
597
+
598
  //Save the data
599
  update_post_meta( $post_id, 'sdm_item_new_window', $new_window_open );
600
+ update_post_meta( $post_id, 'sdm_item_hide_dl_button_single_download_page', $sdm_item_hide_dl_button_single_download_page );
601
  update_post_meta( $post_id, 'sdm_item_disable_single_download_page', $sdm_item_disable_single_download_page );
602
  }
603
 
683
 
684
  //Add all the settings section that will go under the main settings
685
  add_settings_section( 'general_options', __( 'General Options', 'simple-download-monitor' ), array( $this, 'general_options_cb' ), 'general_options_section' );
686
+ add_settings_section( 'user_login_options', __( 'User Login Related', 'simple-download-monitor' ), array( $this, 'user_login_options_cb' ), 'user_login_options_section' );
687
  add_settings_section( 'admin_options', __( 'Admin Options', 'simple-download-monitor' ), array( $this, 'admin_options_cb' ), 'admin_options_section' );
688
 
689
  add_settings_section( 'sdm_colors', __( 'Colors', 'simple-download-monitor' ), array( $this, 'sdm_colors_cb' ), 'sdm_colors_section' );
693
  //Add all the individual settings fields that goes under the sections
694
  add_settings_field( 'general_hide_donwload_count', __( 'Hide Download Count', 'simple-download-monitor' ), array( $this, 'hide_download_count_cb' ), 'general_options_section', 'general_options' );
695
  add_settings_field( 'general_default_dispatch_value', __( 'PHP Dispatching', 'simple-download-monitor' ), array( $this, 'general_default_dispatch_value_cb' ), 'general_options_section', 'general_options' );
696
+
697
+ add_settings_field( 'only_logged_in_can_download', __( 'Only Allow Logged-in Users to Download', 'simple-download-monitor' ), array( $this, 'general_only_logged_in_can_download_cb' ), 'user_login_options_section', 'user_login_options' );
698
+ add_settings_field( 'general_login_page_url', __( 'Login Page URL', 'simple-download-monitor' ), array( $this, 'general_login_page_url_cb' ), 'user_login_options_section', 'user_login_options' );
699
+ add_settings_field( 'redirect_user_back_to_download_page', __( 'Redirect Users to Download Page', 'simple-download-monitor' ), array( $this, 'redirect_user_back_to_download_page_cb' ), 'user_login_options_section', 'user_login_options' );
700
+
701
  add_settings_field( 'admin_tinymce_button', __( 'Remove Tinymce Button', 'simple-download-monitor' ), array( $this, 'admin_tinymce_button_cb' ), 'admin_options_section', 'admin_options' );
702
  add_settings_field( 'admin_log_unique', __( 'Log Unique IP', 'simple-download-monitor' ), array( $this, 'admin_log_unique' ), 'admin_options_section', 'admin_options' );
703
  add_settings_field( 'admin_do_not_capture_ip', __( 'Do Not Capture IP Address', 'simple-download-monitor' ), array( $this, 'admin_do_not_capture_ip' ), 'admin_options_section', 'admin_options' );
734
  _e( 'General options settings', 'simple-download-monitor' );
735
  }
736
 
737
+ public function user_login_options_cb() {
738
+ //Set the message that will be shown below the user login related settings heading
739
+ _e( 'Visitor login related settings (useful if you only want to allow logged-in users to be able to download files.', 'simple-download-monitor' );
740
+ }
741
+
742
  public function admin_options_cb() {
743
  //Set the message that will be shown below the admin options settings heading
744
  _e( 'Admin options settings', 'simple-download-monitor' );
817
  echo '<label for="only_logged_in_can_download">' . __( 'Enable this option if you want to allow downloads only for logged-in users. When enabled, anonymous users clicking on the download button will receive an error message.', 'simple-download-monitor' ) . '</label>';
818
  }
819
 
820
+ public function redirect_user_back_to_download_page_cb() {
821
+ $main_opts = get_option( 'sdm_downloads_options' );
822
+ $value = isset( $main_opts[ 'redirect_user_back_to_download_page' ] ) && $main_opts[ 'redirect_user_back_to_download_page' ];
823
+ echo '<input name="sdm_downloads_options[redirect_user_back_to_download_page]" id="redirect_user_back_to_download_page" type="checkbox" value="1"' . checked( true, $value, false ) . ' />';
824
+ echo '<label for="redirect_user_back_to_download_page">' . __( 'Only works if you have set a Login Page URL value above. Enable this option if you want to redirect the users to the download page after they log into the site.', 'simple-download-monitor' ) . '</label>';
825
+ }
826
+
827
  public function general_login_page_url_cb() {
828
  $main_opts = get_option( 'sdm_downloads_options' );
829
  $value = isset( $main_opts[ 'general_login_page_url' ] ) ? $main_opts[ 'general_login_page_url' ] : '';
1191
  $tiny_button_option = isset( $main_option[ 'admin_tinymce_button' ] );
1192
  if ( $tiny_button_option != true ) {
1193
 
1194
+ // Okay.. we're good. Add the button.
1195
  add_action( 'init', 'sdm_downloads_tinymce_button' );
1196
 
1197
  function sdm_downloads_tinymce_button() {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.tipsandtricks-hq.com
4
  Tags: download, downloads, count, counter, tracker, tracking, hits, logging, monitor, manager, files, media, digital, download monitor, download manager, downloadmanager, file manager, protect downloads, password, download category, file tree, ajax, download template, grid, documents, ip address
5
  Requires at least: 4.1.0
6
  Tested up to: 5.2
7
- Stable tag: 3.7.8
8
  License: GPLv2 or later
9
 
10
  Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
@@ -186,11 +186,21 @@ For screenshots please visit the [download monitor plugin page](https://www.tips
186
 
187
  == Changelog ==
188
 
 
 
 
 
 
 
 
 
 
 
189
  = 3.7.8 =
190
  - Added a new option in the download configuration to disable the individual download page of an item. Can be useful if you only want to allow downloading of the item from where you embed it.
191
 
192
  = 3.7.7 =
193
- - Fixed password protected download error when reCapcha is enabeld.
194
  - Added CSS class to the "Enter Password" label (for password protected downloads).
195
 
196
  = 3.7.6 =
4
  Tags: download, downloads, count, counter, tracker, tracking, hits, logging, monitor, manager, files, media, digital, download monitor, download manager, downloadmanager, file manager, protect downloads, password, download category, file tree, ajax, download template, grid, documents, ip address
5
  Requires at least: 4.1.0
6
  Tested up to: 5.2
7
+ Stable tag: 3.7.9.1
8
  License: GPLv2 or later
9
 
10
  Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
186
 
187
  == Changelog ==
188
 
189
+ = 3.7.9.1 =
190
+ - Improved the after login redirection feature so it is compatible with login via wp-login.php.
191
+ - Added a new filter hook.
192
+
193
+ = 3.7.9 =
194
+ - Added a new option in the download configuration to disable the download button on the individual download page of an item.
195
+ - Added a new utility function to read the current page's URL.
196
+ - Moved the user login related options under a new settings section called "User Login Related".
197
+ - Added a new feature to enable redirection of users back to the download page when they click on the login link and log into the site.
198
+
199
  = 3.7.8 =
200
  - Added a new option in the download configuration to disable the individual download page of an item. Can be useful if you only want to allow downloading of the item from where you embed it.
201
 
202
  = 3.7.7 =
203
+ - Fixed password protected download error when reCapcha is enabled.
204
  - Added CSS class to the "Enter Password" label (for password protected downloads).
205
 
206
  = 3.7.6 =
sdm-post-type-content-handler.php CHANGED
@@ -3,7 +3,7 @@
3
  //Handles the output on the SDM individual download page (Custom Post Type)
4
  add_filter( 'the_content', 'filter_sdm_post_type_content' );
5
 
6
- function filter_sdm_post_type_content( $content ) {
7
  global $post;
8
  if ( isset( $post->post_type ) && $post->post_type == "sdm_downloads" ) {//Handle the content for sdm_downloads type post
9
  //$download_id = $post->ID;
@@ -21,7 +21,7 @@ function filter_sdm_post_type_content( $content ) {
21
  $content .= '</div>';
22
  return $content;
23
  }
24
-
25
  //Check to see if the download link cpt is password protected
26
  $get_cpt_object = get_post( $id );
27
  $cpt_is_password = ! empty( $get_cpt_object->post_password ) ? 'yes' : 'no'; // yes = download is password protected;
@@ -118,8 +118,18 @@ function filter_sdm_post_type_content( $content ) {
118
  //This hook can be used to add content below the description
119
  $content .= apply_filters( 'sdm_cpt_below_download_description', '' );
120
 
121
- $content .= '<div class="sdm_post_download_section"><div class="sdm_download_link">' . $download_button_code . '</div></div>';
122
-
 
 
 
 
 
 
 
 
 
 
123
  if ( ! empty( $isset_item_file_size ) ) {//Show file size info
124
  $content .= '<div class="sdm_post_download_file_size">';
125
  $content .= '<span class="sdm_post_download_size_label">' . __( 'Size: ', 'simple-download-monitor' ) . '</span>';
3
  //Handles the output on the SDM individual download page (Custom Post Type)
4
  add_filter( 'the_content', 'filter_sdm_post_type_content' );
5
 
6
+ function filter_sdm_post_type_content( $content ) {
7
  global $post;
8
  if ( isset( $post->post_type ) && $post->post_type == "sdm_downloads" ) {//Handle the content for sdm_downloads type post
9
  //$download_id = $post->ID;
21
  $content .= '</div>';
22
  return $content;
23
  }
24
+
25
  //Check to see if the download link cpt is password protected
26
  $get_cpt_object = get_post( $id );
27
  $cpt_is_password = ! empty( $get_cpt_object->post_password ) ? 'yes' : 'no'; // yes = download is password protected;
118
  //This hook can be used to add content below the description
119
  $content .= apply_filters( 'sdm_cpt_below_download_description', '' );
120
 
121
+ //Check if the button of the single download page is disabled.
122
+ $sdm_item_hide_dl_button_single_download_page = get_post_meta( $id, 'sdm_item_hide_dl_button_single_download_page', true );
123
+ if ($sdm_item_hide_dl_button_single_download_page){
124
+ //the download button is disabled.
125
+ $content .= '<div class="sdm_post_single_download_page_disabled_dl_button_msg">';
126
+ $msg = '<p>' . __('The admin of this site has disabled the download button for this page.', 'simple-download-monitor') . '</p>';
127
+ $content .= apply_filters('sdm_post_single_download_page_disabled_dl_button_msg', $msg);
128
+ $content .= '</div>';
129
+ } else {
130
+ $content .= '<div class="sdm_post_download_section"><div class="sdm_download_link">' . $download_button_code . '</div></div>';
131
+ }
132
+
133
  if ( ! empty( $isset_item_file_size ) ) {//Show file size info
134
  $content .= '<div class="sdm_post_download_file_size">';
135
  $content .= '<span class="sdm_post_download_size_label">' . __( 'Size: ', 'simple-download-monitor' ) . '</span>';