PluginProbe
User Submitted Posts – Enable Users to Submit Posts from the Front End / 20260110
User Submitted Posts – Enable Users to Submit Posts from the Front End v20260110
20260916 20260810 20260608 20230806 20230809 20230811 20230901 20230902 20230914 20231102 20240319 20240516 20240703 20241026 20250327 20250329 20251121 20251210 20260110 20260113 20260207 20260217 20260407 20260422 trunk All 59 releases
user-submitted-posts / views / submission-form-alt.php

submission-form-alt.php in User Submitted Posts – Enable Users to Submit Posts from the Front End 20260110, at views/submission-form-alt.php

225 lines 11.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // User Submitted Posts - Alternate/Custom Submission Form
2
3 /*
4
5 You can use this file instead of submission-form.php for a custom form.
6 For more information, check out the section, "Custom Submission Form"
7 @ https://wordpress.org/plugins/user-submitted-posts/#installation
8
9 NOTES:
10
11 This template, submission-form-alt.php, returns the form on successful post submission.
12 The other template, submission-form.php, returns only the success message.
13
14 */
15
16 if (!defined('ABSPATH')) die();
17
18 if (isset($usp_options['logged_in_users']) && $usp_options['logged_in_users'] && !is_user_logged_in()) :
19
20 echo usp_login_required_message();
21
22 else :
23
24 extract(usp_get_form_vars());
25
26 if (isset($_GET['success']) && $_GET['success'] == '1') {
27
28 echo '<div id="usp-success-message">'. $usp_options['success-message'] .'</div>';
29
30 }
31
32 ?>
33
34 <!-- User Submitted Posts @ https://m0n.co/usp -->
35
36 <div id="user-submitted-posts">
37 <?php if ($usp_options['usp_form_content'] !== '') echo $usp_options['usp_form_content']; ?>
38
39 <form id="usp_form" method="post" enctype="multipart/form-data" action="">
40 <div id="usp-error-message" class="usp-callout-failure usp-hidden"><?php esc_html_e('Please complete the required fields.', 'usp'); ?></div>
41 <?php echo usp_error_message();
42
43 if (($usp_options['usp_name'] == 'show' || $usp_options['usp_name'] == 'optn') && ($usp_display_name)) { ?>
44
45 <fieldset class="usp-name">
46 <label for="user-submitted-name"><?php esc_html_e('Your Name', 'usp'); ?></label>
47 <input id="user-submitted-name" name="user-submitted-name" type="text" value="" placeholder="<?php esc_attr_e('Your Name', 'usp'); ?>"<?php if (usp_check_required('usp_name')) echo $usp_required; ?> class="usp-input">
48 </fieldset>
49 <?php } if (($usp_options['usp_email'] == 'show' || $usp_options['usp_email'] == 'optn') && ($usp_display_email)) { ?>
50
51 <fieldset class="usp-email">
52 <label for="user-submitted-email"><?php esc_html_e('Your Email', 'usp'); ?></label>
53 <input id="user-submitted-email" name="user-submitted-email" type="email" data-parsley-type="email" value="" placeholder="<?php esc_attr_e('Your Email', 'usp'); ?>"<?php if (usp_check_required('usp_email')) echo $usp_required; ?> class="usp-input">
54 </fieldset>
55 <?php } if (($usp_options['usp_url'] == 'show' || $usp_options['usp_url'] == 'optn') && ($usp_display_url)) { ?>
56
57 <fieldset class="usp-url">
58 <label for="user-submitted-url"><?php esc_html_e('Your URL', 'usp'); ?></label>
59 <input id="user-submitted-url" name="user-submitted-url" type="url" data-parsley-type="url" value="" placeholder="<?php esc_attr_e('Your URL', 'usp'); ?>"<?php if (usp_check_required('usp_url')) echo $usp_required; ?> class="usp-input">
60 </fieldset>
61 <?php } if ($usp_options['usp_title'] == 'show' || $usp_options['usp_title'] == 'optn') { ?>
62
63 <fieldset class="usp-title">
64 <label for="user-submitted-title"><?php esc_html_e('Post Title', 'usp'); ?></label>
65 <input id="user-submitted-title" name="user-submitted-title" type="text" value="" placeholder="<?php esc_attr_e('Post Title', 'usp'); ?>"<?php if (usp_check_required('usp_title')) echo $usp_required; ?> class="usp-input">
66 </fieldset>
67 <?php } if ($usp_options['usp_tags'] == 'show' || $usp_options['usp_tags'] == 'optn') { ?>
68 <?php if ($usp_existing_tags) { ?>
69
70 <fieldset class="usp-tags">
71 <label for="user-submitted-tags"><?php esc_html_e('Post Tags', 'usp'); ?></label>
72 <select id="user-submitted-tags" name="user-submitted-tags[]"<?php if (usp_check_required('usp_tags')) echo $usp_required; ?> class="usp-select usp-multiple" multiple="multiple">
73 <option value="" disabled><?php esc_attr_e('Please select some tags..', 'usp'); ?></option>
74 <?php echo usp_get_tag_options(); ?>
75 </select>
76 </fieldset>
77 <?php } else { ?>
78
79 <fieldset class="usp-tags">
80 <label for="user-submitted-tags"><?php esc_html_e('Post Tags', 'usp'); ?></label>
81 <input id="user-submitted-tags" name="user-submitted-tags" type="text" value="" placeholder="<?php esc_attr_e('Post Tags', 'usp'); ?>"<?php if (usp_check_required('usp_tags')) echo $usp_required; ?> class="usp-input">
82 </fieldset>
83 <?php } ?>
84 <?php } if ($usp_options['custom_field'] == 'show' || $usp_options['custom_field'] == 'optn') { ?>
85
86 <fieldset class="usp-custom">
87 <label for="user-submitted-custom"><?php echo esc_html($usp_custom_label); ?></label>
88 <input id="user-submitted-custom" name="<?php echo esc_attr($usp_custom_name); ?>" type="text" value="" placeholder="<?php echo esc_attr($usp_custom_label); ?>"<?php if (usp_check_required('custom_field')) echo $usp_required; ?> class="usp-input">
89 </fieldset>
90 <?php } if ($usp_options['custom_field_2'] == 'show' || $usp_options['custom_field_2'] == 'optn') { ?>
91
92 <fieldset class="usp-custom-2">
93 <label for="user-submitted-custom-2"><?php echo esc_html($usp_custom_label_2); ?></label>
94 <input id="user-submitted-custom-2" name="<?php echo esc_attr($usp_custom_name_2); ?>" type="text" value="" placeholder="<?php echo esc_attr($usp_custom_label_2); ?>"<?php if (usp_check_required('custom_field_2')) echo $usp_required; ?> class="usp-input">
95 </fieldset>
96 <?php } if ($usp_options['usp_captcha'] == 'show') { ?>
97
98 <fieldset class="usp-captcha">
99 <label for="user-submitted-captcha"><?php echo $usp_options['usp_question']; ?></label>
100 <input id="user-submitted-captcha" name="user-submitted-captcha" type="text" value="" placeholder="<?php esc_attr_e('Antispam Question', 'usp'); ?>"<?php echo $usp_required; ?> class="usp-input<?php echo $usp_captcha; ?>" data-parsley-excluded="true">
101 </fieldset>
102 <?php } if ($usp_options['usp_turnstile'] == 'show') { ?>
103
104 <?php echo usp_display_turnstile(); ?>
105
106 <?php } if (($usp_options['usp_category'] == 'show' || $usp_options['usp_category'] == 'optn') && ($usp_options['usp_use_cat'] == false)) { ?>
107
108 <fieldset class="usp-category">
109 <label for="user-submitted-category"><?php esc_html_e('Post Category', 'usp'); ?></label>
110 <select id="user-submitted-category"<?php if (usp_check_required('usp_category')) echo $usp_required; echo $multiple_cats . $category_class; ?> name="user-submitted-category[]">
111 <option value="" selected="true" disabled><?php esc_html_e('Please select a category..', 'usp'); ?></option>
112 <?php echo usp_get_cat_options(); ?>
113 </select>
114 </fieldset>
115 <?php } if ($usp_options['usp_content'] == 'show' || $usp_options['usp_content'] == 'optn') { ?>
116
117 <fieldset class="usp-content">
118 <?php if ($usp_options['usp_richtext_editor'] == true) { ?>
119
120 <div class="usp_text-editor">
121 <?php $usp_rte_settings = array(
122 'wpautop' => true, // enable rich text editor
123 'media_buttons' => true, // enable add media button
124 'textarea_name' => 'user-submitted-content', // name
125 'textarea_rows' => '10', // number of textarea rows
126 'tabindex' => '', // tabindex
127 'editor_css' => '', // extra CSS
128 'editor_class' => 'usp-rich-textarea', // class
129 'teeny' => false, // output minimal editor config
130 'dfw' => false, // replace fullscreen with DFW
131 'tinymce' => true, // enable TinyMCE
132 'quicktags' => true, // enable quicktags
133 'drag_drop_upload' => true, // enable drag-drop
134 );
135 $usp_rte_settings = apply_filters('usp_editor_settings', $usp_rte_settings);
136 $usp_editor_content = apply_filters('usp_editor_content', '');
137 wp_editor($usp_editor_content, 'uspcontent', $usp_rte_settings); ?>
138
139 </div>
140 <?php } else { ?>
141
142 <label for="user-submitted-content"><?php esc_html_e('Post Content', 'usp'); ?></label>
143 <textarea id="user-submitted-content" name="user-submitted-content" rows="5" placeholder="<?php esc_attr_e('Post Content', 'usp'); ?>"<?php if (usp_check_required('usp_content')) echo $usp_required; ?> class="usp-textarea"></textarea>
144 <?php } ?>
145
146 </fieldset>
147 <?php } if ($usp_recaptcha_public && $usp_recaptcha_private && $usp_recaptcha_display == 'show' && $usp_recaptcha_version == 2) { ?>
148
149 <fieldset class="usp-recaptcha">
150 <label for="g-recaptcha"><?php esc_html_e('Verification', 'usp'); ?></label>
151 <div id="g-recaptcha" class="g-recaptcha" data-sitekey="<?php echo esc_attr($usp_data_sitekey); ?>"></div>
152 </fieldset>
153 <?php } if ($usp_options['usp_images'] == 'show') { ?>
154 <?php if ($usp_options['max-images'] !== 0) { ?>
155
156 <fieldset class="usp-images">
157 <label for="user-submitted-image"><?php esc_html_e('Upload an Image', 'usp'); ?></label>
158 <div id="usp-upload-message"><?php esc_html_e($usp_options['upload-message'], 'usp'); ?></div>
159 <div id="user-submitted-image">
160 <?php // upload files
161
162 $usp_minImages = intval($usp_options['min-images']);
163 $usp_maxImages = intval($usp_options['max-images']);
164 $usp_addAnother = $usp_options['usp_add_another'];
165
166 if (empty($usp_addAnother)) $usp_addAnother = '<a href="#" id="usp_add-another" class="usp-no-js">'. esc_html__('Add another image', 'usp') .'</a>';
167
168 if ($usp_minImages > 0) : ?>
169 <?php for ($i = 0; $i < $usp_minImages; $i++) : ?>
170
171 <input name="user-submitted-image[]" type="file" size="25"<?php echo $usp_required; ?> class="usp-input usp-clone" accept="image/*">
172 <?php endfor; ?>
173 <?php if ($usp_minImages < $usp_maxImages) : echo $usp_addAnother; endif; ?>
174 <?php else : ?>
175
176 <input name="user-submitted-image[]" type="file" size="25" class="usp-input usp-clone" data-parsley-excluded="true" accept="image/*">
177 <?php echo $usp_addAnother; ?>
178 <?php endif; ?>
179
180 </div>
181 <input type="hidden" class="usp-hidden" id="usp-min-images" name="usp-min-images" value="<?php echo $usp_options['min-images']; ?>">
182 <input type="hidden" class="usp-hidden" id="usp-max-images" name="usp-max-images" value="<?php echo $usp_options['max-images']; ?>">
183 </fieldset>
184 <?php } ?>
185 <?php } ?>
186
187 <fieldset id="usp_verify" style="display:none;">
188 <label for="user-submitted-verify"><?php esc_html_e('Human verification: leave this field empty.', 'usp'); ?></label>
189 <input id="user-submitted-verify" name="user-submitted-verify" type="text" value="" data-parsley-excluded="true">
190 </fieldset>
191
192 <?php echo usp_display_custom_checkbox(); ?>
193
194 <div id="usp-submit">
195 <?php if (isset($usp_options['redirect-url']) && !empty($usp_options['redirect-url'])) { ?>
196
197 <input type="hidden" class="usp-hidden" name="redirect-override" value="<?php echo esc_url($usp_options['redirect-url']); ?>">
198 <?php } ?>
199 <?php if (!$usp_display_name) { ?>
200
201 <input type="hidden" class="usp-hidden" name="user-submitted-name" value="<?php echo esc_attr($usp_user_name); ?>">
202 <?php } ?>
203 <?php if (!$usp_display_email) { ?>
204
205 <input type="hidden" class="usp-hidden" name="user-submitted-email" value="<?php echo sanitize_email($usp_user_email); ?>">
206 <?php } ?>
207 <?php if (!$usp_display_url) { ?>
208
209 <input type="hidden" class="usp-hidden" name="user-submitted-url" value="<?php echo esc_url($usp_user_url); ?>">
210 <?php } ?>
211 <?php if (isset($usp_options['usp_use_cat']) && $usp_options['usp_use_cat'] == true) { ?>
212
213 <input type="hidden" class="usp-hidden" name="user-submitted-category" value="<?php echo esc_attr($usp_options['usp_use_cat_id']); ?>">
214 <?php } ?>
215
216 <input type="submit" class="usp-submit" id="user-submitted-post" name="user-submitted-post" value="<?php esc_attr_e('Submit Post', 'usp'); ?>">
217 <?php wp_nonce_field('usp-nonce', 'usp-nonce', false); ?>
218
219 </div>
220
221 </form>
222 </div>
223 <script>(function(){var e = document.getElementById('usp_verify'); if(e) e.parentNode.removeChild(e);})();</script>
224
225 <?php endif; ?>