User Submitted Posts - Version 20220123

Version Description

To upgrade User Submitted Posts, remove the old version and replace with the new version. Or just click "Update" from the Plugins screen and let WordPress do it for you automatically.

Important! The /custom/ directory is deprecated. If you are using a custom form template, please move it to /wp-content/your-theme/usp/. For more information, check out the "Custom Submission Form" section under Installation.

Note: uninstalling the plugin from the WP Plugins screen results in the removal of all settings from the WP database. Submitted posts are NOT removed if you deactivate the plugin, reset default options, or uninstall the plugins; that is, all submitted posts (and any attached meta data) must be removed manually.

Download this release

Release Info

Developer specialk
Plugin Icon 128x128 User Submitted Posts
Version 20220123
Comparing to
See all releases

Code changes from version 20210719 to 20220123

images/250x250-wizards-sql.jpg ADDED
Binary file
library/enqueue-scripts.php CHANGED
@@ -237,6 +237,7 @@ function usp_load_admin_styles($hook) {
237
 
238
  wp_enqueue_style('usp_admin_styles', $base .'/resources/usp-admin.css', array(), USP_VERSION, 'all');
239
  wp_enqueue_script('usp_admin_script', $base .'/resources/jquery.usp.admin.js', array('jquery'), USP_VERSION, false);
 
240
 
241
  }
242
 
237
 
238
  wp_enqueue_style('usp_admin_styles', $base .'/resources/usp-admin.css', array(), USP_VERSION, 'all');
239
  wp_enqueue_script('usp_admin_script', $base .'/resources/jquery.usp.admin.js', array('jquery'), USP_VERSION, false);
240
+ wp_enqueue_media();
241
 
242
  }
243
 
library/plugin-settings.php CHANGED
@@ -990,6 +990,8 @@ function usp_validate_options($input) {
990
  if (isset($input['custom_checkbox_name'])) $input['custom_checkbox_name'] = wp_filter_nohtml_kses($input['custom_checkbox_name']); else $input['custom_checkbox_name'] = null;
991
  if (isset($input['custom_checkbox_err'])) $input['custom_checkbox_err'] = wp_filter_nohtml_kses($input['custom_checkbox_err']); else $input['custom_checkbox_err'] = null;
992
 
 
 
993
  // dealing with kses
994
  global $allowedposttags;
995
  $allowed_atts = array(
@@ -1561,6 +1563,14 @@ function usp_render_form() {
1561
  <td><input type="checkbox" value="1" name="usp_options[usp_featured_images]" <?php if (isset($usp_options['usp_featured_images'])) checked('1', $usp_options['usp_featured_images']); ?> />
1562
  <span class="mm-item-caption"><?php esc_html_e('Set submitted images as Featured Images. Requires theme support for Featured Images (aka Post Thumbnails)', 'usp'); ?></span></td>
1563
  </tr>
 
 
 
 
 
 
 
 
1564
  <tr>
1565
  <th scope="row"><label class="description" for="usp_options[upload-message]"><?php esc_html_e('Upload Message', 'usp'); ?></label></th>
1566
  <td><textarea class="textarea" rows="3" cols="50" name="usp_options[upload-message]"><?php if (isset($usp_options['upload-message'])) echo esc_textarea($usp_options['upload-message']); ?></textarea>
990
  if (isset($input['custom_checkbox_name'])) $input['custom_checkbox_name'] = wp_filter_nohtml_kses($input['custom_checkbox_name']); else $input['custom_checkbox_name'] = null;
991
  if (isset($input['custom_checkbox_err'])) $input['custom_checkbox_err'] = wp_filter_nohtml_kses($input['custom_checkbox_err']); else $input['custom_checkbox_err'] = null;
992
 
993
+ if (isset($input['usp_featured_image_default'])) $input['usp_featured_image_default'] = wp_filter_nohtml_kses($input['usp_featured_image_default']); else $input['usp_featured_image_default'] = null;
994
+
995
  // dealing with kses
996
  global $allowedposttags;
997
  $allowed_atts = array(
1563
  <td><input type="checkbox" value="1" name="usp_options[usp_featured_images]" <?php if (isset($usp_options['usp_featured_images'])) checked('1', $usp_options['usp_featured_images']); ?> />
1564
  <span class="mm-item-caption"><?php esc_html_e('Set submitted images as Featured Images. Requires theme support for Featured Images (aka Post Thumbnails)', 'usp'); ?></span></td>
1565
  </tr>
1566
+ <tr>
1567
+ <th scope="row"><label class="description" for="usp_options[usp_featured_image_default]"><?php esc_html_e('Default Featured Image', 'usp'); ?></label></th>
1568
+ <td>
1569
+ <input id="upload_image" type="text" size="36" name="usp_options[usp_featured_image_default]" value="<?php if (isset($usp_options['usp_featured_image_default'])) echo esc_attr($usp_options['usp_featured_image_default']); ?>" />
1570
+ <input id="upload_image_button" class="button" type="button" value="Upload Image" />
1571
+ <div class="mm-item-caption"><?php esc_html_e('Choose a default Featured Image (optional). After selecting an image, scroll down and click the &ldquo;Save Settings&rdquo; button.', 'usp'); ?></div>
1572
+ </td>
1573
+ </tr>
1574
  <tr>
1575
  <th scope="row"><label class="description" for="usp_options[upload-message]"><?php esc_html_e('Upload Message', 'usp'); ?></label></th>
1576
  <td><textarea class="textarea" rows="3" cols="50" name="usp_options[upload-message]"><?php if (isset($usp_options['upload-message'])) echo esc_textarea($usp_options['upload-message']); ?></textarea>
library/shortcode-misc.php CHANGED
@@ -64,8 +64,9 @@ function usp_display_posts($attr = array(), $content = null) {
64
 
65
  extract(shortcode_atts(array(
66
 
67
- 'userid' => 'all',
68
- 'numposts' => -1
 
69
 
70
  ), $attr));
71
 
@@ -74,6 +75,7 @@ function usp_display_posts($attr = array(), $content = null) {
74
  $args = array(
75
  'author' => $userid,
76
  'posts_per_page' => $numposts,
 
77
  'meta_key' => 'is_submission',
78
  'meta_value' => '1'
79
  );
@@ -82,6 +84,7 @@ function usp_display_posts($attr = array(), $content = null) {
82
 
83
  $args = array(
84
  'posts_per_page' => $numposts,
 
85
  'meta_key' => 'is_submission',
86
  'meta_value' => '1'
87
  );
@@ -91,6 +94,7 @@ function usp_display_posts($attr = array(), $content = null) {
91
  $args = array(
92
  'author' => get_current_user_id(),
93
  'posts_per_page' => $numposts,
 
94
  'meta_key' => 'is_submission',
95
  'meta_value' => '1'
96
  );
@@ -99,6 +103,7 @@ function usp_display_posts($attr = array(), $content = null) {
99
 
100
  $args = array(
101
  'posts_per_page' => $numposts,
 
102
 
103
  'meta_query' => array(
104
 
64
 
65
  extract(shortcode_atts(array(
66
 
67
+ 'userid' => 'all',
68
+ 'post_type' => 'post',
69
+ 'numposts' => -1,
70
 
71
  ), $attr));
72
 
75
  $args = array(
76
  'author' => $userid,
77
  'posts_per_page' => $numposts,
78
+ 'post_type' => $post_type,
79
  'meta_key' => 'is_submission',
80
  'meta_value' => '1'
81
  );
84
 
85
  $args = array(
86
  'posts_per_page' => $numposts,
87
+ 'post_type' => $post_type,
88
  'meta_key' => 'is_submission',
89
  'meta_value' => '1'
90
  );
94
  $args = array(
95
  'author' => get_current_user_id(),
96
  'posts_per_page' => $numposts,
97
+ 'post_type' => $post_type,
98
  'meta_key' => 'is_submission',
99
  'meta_value' => '1'
100
  );
103
 
104
  $args = array(
105
  'posts_per_page' => $numposts,
106
+ 'post_type' => $post_type,
107
 
108
  'meta_query' => array(
109
 
library/support-panel.php CHANGED
@@ -39,6 +39,9 @@ $array = array(
39
  9 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/ga-google-analytics-pro/" title="Connect Google Analytics to WordPress">
40
  <img width="125" height="125" src="'. $plugin_url .'images/250x250-ga-pro.jpg" alt="GA Google Analytics Pro" />
41
  </a>',
 
 
 
42
 
43
  );
44
 
39
  9 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/ga-google-analytics-pro/" title="Connect Google Analytics to WordPress">
40
  <img width="125" height="125" src="'. $plugin_url .'images/250x250-ga-pro.jpg" alt="GA Google Analytics Pro" />
41
  </a>',
42
+ 10 => '<a target="_blank" rel="noopener noreferrer" href="https://books.perishablepress.com/downloads/wizards-collection-sql-recipes-wordpress/" title="Wizard&rsquo;s SQL Recipes for WordPress">
43
+ <img width="125" height="125" src="'. $plugin_url .'images/250x250-wizards-sql.jpg" alt="Wizard&rsquo;s SQL Recipes for WordPress" />
44
+ </a>',
45
 
46
  );
47
 
readme.txt CHANGED
@@ -8,10 +8,10 @@ Author: Jeff Starr
8
  Author URI: https://plugin-planet.com/
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
- Requires at least: 4.1
12
- Tested up to: 5.8
13
- Stable tag: 20210719
14
- Version: 20210719
15
  Requires PHP: 5.6.20
16
  Text Domain: usp
17
  Domain Path: /languages
@@ -168,7 +168,7 @@ User Submitted Posts supports translation into any language. Current translation
168
  Chinese (Simplified) - usp-zh_CN
169
  Chinese (Traditional) - usp-zh_TW
170
 
171
- __Note:__ most of the default translations are made via Google Translate. So they are automated and may be a little rough. Feel free to make your own translation as desired. Need a translation into your language? [Let me know!](https://perishablepress.com/contact/)
172
 
173
 
174
  ### Privacy ###
@@ -347,6 +347,7 @@ Displays a list of all submitted posts. This shortcode accepts two optional attr
347
  [usp_display_posts userid="Pat Smith"] : displays all submitted posts by author name "Pat Smith"
348
  [usp_display_posts userid="all"] : displays all submitted posts by all users/authors
349
  [usp_display_posts userid="all" numposts="5"] : limit to 5 posts from all users
 
350
 
351
  So the shortcode attributes can be used to customize the post list as desired. Note that the Pro version of USP provides many more options for the [display-posts shortcode](https://plugin-planet.com/usp-pro-display-list-submitted-posts/).
352
 
@@ -730,7 +731,7 @@ Want to read some more FAQs? Check out the [USP FAQs at Perishable Press](https:
730
 
731
  **Questions? Feedback?**
732
 
733
- Send any questions or feedback via my [contact form](https://perishablepress.com/contact/). Thanks! :)
734
 
735
 
736
 
@@ -742,6 +743,7 @@ I develop and maintain this free plugin with love for the WordPress community. T
742
  * [Digging into WordPress](https://digwp.com/)
743
  * [.htaccess made easy](https://htaccessbook.com/)
744
  * [WordPress Themes In Depth](https://wp-tao.com/wordpress-themes-book/)
 
745
 
746
  And/or purchase one of my premium WordPress plugins:
747
 
@@ -762,6 +764,16 @@ Links, tweets and likes also appreciated. Thanks! :)
762
  If you like USP, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/user-submitted-posts/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!
763
 
764
 
 
 
 
 
 
 
 
 
 
 
765
  **20210719**
766
 
767
  * Adds CSS classes to Login/Register form
8
  Author URI: https://plugin-planet.com/
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
+ Requires at least: 4.6
12
+ Tested up to: 5.9
13
+ Stable tag: 20220123
14
+ Version: 20220123
15
  Requires PHP: 5.6.20
16
  Text Domain: usp
17
  Domain Path: /languages
168
  Chinese (Simplified) - usp-zh_CN
169
  Chinese (Traditional) - usp-zh_TW
170
 
171
+ __Note:__ most of the default translations are made via Google Translate. So they are automated and may be a little rough. Feel free to make your own translation as desired. Need a translation into your language? [Let me know!](https://plugin-planet.com/support/#contact)
172
 
173
 
174
  ### Privacy ###
347
  [usp_display_posts userid="Pat Smith"] : displays all submitted posts by author name "Pat Smith"
348
  [usp_display_posts userid="all"] : displays all submitted posts by all users/authors
349
  [usp_display_posts userid="all" numposts="5"] : limit to 5 posts from all users
350
+ [usp_display_posts post_type="page"] : display only submitted pages
351
 
352
  So the shortcode attributes can be used to customize the post list as desired. Note that the Pro version of USP provides many more options for the [display-posts shortcode](https://plugin-planet.com/usp-pro-display-list-submitted-posts/).
353
 
731
 
732
  **Questions? Feedback?**
733
 
734
+ Send any questions or feedback via my [contact form](https://plugin-planet.com/support/#contact). Thanks! :)
735
 
736
 
737
 
743
  * [Digging into WordPress](https://digwp.com/)
744
  * [.htaccess made easy](https://htaccessbook.com/)
745
  * [WordPress Themes In Depth](https://wp-tao.com/wordpress-themes-book/)
746
+ * [Wizard's SQL Recipes for WordPress](https://books.perishablepress.com/downloads/wizards-collection-sql-recipes-wordpress/)
747
 
748
  And/or purchase one of my premium WordPress plugins:
749
 
764
  If you like USP, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/user-submitted-posts/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!
765
 
766
 
767
+ **20220123**
768
+
769
+ * Updates support panel
770
+ * Improves loading of translations
771
+ * Adds option to select a default Featured Image
772
+ * Adds `post_type` attribute to `[usp_display_posts]`
773
+ * Updates some links to external resources
774
+ * Changes minimum required WP version to 4.6
775
+ * Tests on WordPress 5.9
776
+
777
  **20210719**
778
 
779
  * Adds CSS classes to Login/Register form
resources/jquery.usp.admin.js CHANGED
@@ -42,4 +42,26 @@ jQuery(document).ready(function($){
42
  return false;
43
  });
44
 
45
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  return false;
43
  });
44
 
45
+ // image uploader
46
+ var custom_uploader;
47
+ $('#upload_image_button').click(function(e) {
48
+ e.preventDefault();
49
+ if (custom_uploader) {
50
+ custom_uploader.open();
51
+ return;
52
+ }
53
+ custom_uploader = wp.media.frames.file_frame = wp.media({
54
+ multiple: false,
55
+ library: { type: 'image' },
56
+ button: { text: 'Select Image' },
57
+ title: 'Select Default Featured Image',
58
+ });
59
+ custom_uploader.on('select', function() {
60
+ console.log(custom_uploader.state().get('selection').toJSON());
61
+ attachment = custom_uploader.state().get('selection').first().toJSON();
62
+ $('#upload_image').val(attachment.url);
63
+ });
64
+ custom_uploader.open();
65
+ });
66
+
67
+ });
user-submitted-posts.php CHANGED
@@ -8,10 +8,10 @@
8
  Author URI: https://plugin-planet.com/
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
- Requires at least: 4.1
12
- Tested up to: 5.8
13
- Stable tag: 20210719
14
- Version: 20210719
15
  Requires PHP: 5.6.20
16
  Text Domain: usp
17
  Domain Path: /languages
@@ -32,15 +32,15 @@
32
  You should have received a copy of the GNU General Public License
33
  with this program. If not, visit: https://www.gnu.org/licenses/
34
 
35
- Copyright 2021 Monzilla Media. All rights reserved.
36
  */
37
 
38
  if (!defined('ABSPATH')) die();
39
 
40
 
41
 
42
- define('USP_WP_VERSION', '4.1');
43
- define('USP_VERSION', '20210719');
44
  define('USP_PLUGIN', esc_html__('User Submitted Posts', 'usp'));
45
  define('USP_PATH', plugin_basename(__FILE__));
46
 
@@ -62,7 +62,7 @@ function usp_i18n_init() {
62
  load_plugin_textdomain('usp', false, dirname(plugin_basename(__FILE__)) .'/languages/');
63
 
64
  }
65
- add_action('plugins_loaded', 'usp_i18n_init');
66
 
67
 
68
 
@@ -1110,6 +1110,20 @@ function usp_attach_images($post_id, $newPost, $files, $file_count) {
1110
 
1111
  }
1112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1113
  }
1114
 
1115
  do_action('usp_files_after', $attach_ids);
8
  Author URI: https://plugin-planet.com/
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
+ Requires at least: 4.6
12
+ Tested up to: 5.9
13
+ Stable tag: 20220123
14
+ Version: 20220123
15
  Requires PHP: 5.6.20
16
  Text Domain: usp
17
  Domain Path: /languages
32
  You should have received a copy of the GNU General Public License
33
  with this program. If not, visit: https://www.gnu.org/licenses/
34
 
35
+ Copyright 2022 Monzilla Media. All rights reserved.
36
  */
37
 
38
  if (!defined('ABSPATH')) die();
39
 
40
 
41
 
42
+ define('USP_WP_VERSION', '4.6');
43
+ define('USP_VERSION', '20220123');
44
  define('USP_PLUGIN', esc_html__('User Submitted Posts', 'usp'));
45
  define('USP_PATH', plugin_basename(__FILE__));
46
 
62
  load_plugin_textdomain('usp', false, dirname(plugin_basename(__FILE__)) .'/languages/');
63
 
64
  }
65
+ add_action('init', 'usp_i18n_init');
66
 
67
 
68
 
1110
 
1111
  }
1112
 
1113
+ } else {
1114
+
1115
+ if (isset($usp_options['usp_featured_image_default']) && !empty($usp_options['usp_featured_image_default'])) {
1116
+
1117
+ $default_image = attachment_url_to_postid($usp_options['usp_featured_image_default']);
1118
+
1119
+ if (!empty($default_image) && isset($usp_options['usp_featured_images']) && $usp_options['usp_featured_images']) {
1120
+
1121
+ if (!has_post_thumbnail($post_id)) set_post_thumbnail($post_id, $default_image);
1122
+
1123
+ }
1124
+
1125
+ }
1126
+
1127
  }
1128
 
1129
  do_action('usp_files_after', $attach_ids);