PluginProbe
User Submitted Posts – Enable Users to Submit Posts from the Front End / 20231102
User Submitted Posts – Enable Users to Submit Posts from the Front End v20231102
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 20231102, at views/submission-form-alt.php

221 lines 11.4 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_category'] == 'show' || $usp_options['usp_category'] == 'optn') && ($usp_options['usp_use_cat'] == false)) { ?>
103
104 <fieldset class="usp-category">
105 <label for="user-submitted-category"><?php esc_html_e('Post Category', 'usp'); ?></label>
106 <select id="user-submitted-category"<?php if (usp_check_required('usp_category')) echo $usp_required; echo $multiple_cats . $category_class; ?> name="user-submitted-category[]">
107 <option value="" selected="true" disabled><?php esc_html_e('Please select a category..', 'usp'); ?></option>
108 <?php echo usp_get_cat_options(); ?>
109 </select>
110 </fieldset>
111 <?php } if ($usp_options['usp_content'] == 'show' || $usp_options['usp_content'] == 'optn') { ?>
112
113 <fieldset class="usp-content">
114 <?php if ($usp_options['usp_richtext_editor'] == true) { ?>
115
116 <div class="usp_text-editor">
117 <?php $usp_rte_settings = array(
118 'wpautop' => true, // enable rich text editor
119 'media_buttons' => true, // enable add media button
120 'textarea_name' => 'user-submitted-content', // name
121 'textarea_rows' => '10', // number of textarea rows
122 'tabindex' => '', // tabindex
123 'editor_css' => '', // extra CSS
124 'editor_class' => 'usp-rich-textarea', // class
125 'teeny' => false, // output minimal editor config
126 'dfw' => false, // replace fullscreen with DFW
127 'tinymce' => true, // enable TinyMCE
128 'quicktags' => true, // enable quicktags
129 'drag_drop_upload' => true, // enable drag-drop
130 );
131 $usp_rte_settings = apply_filters('usp_editor_settings', $usp_rte_settings);
132 $usp_editor_content = apply_filters('usp_editor_content', '');
133 wp_editor($usp_editor_content, 'uspcontent', $usp_rte_settings); ?>
134
135 </div>
136 <?php } else { ?>
137
138 <label for="user-submitted-content"><?php esc_html_e('Post Content', 'usp'); ?></label>
139 <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>
140 <?php } ?>
141
142 </fieldset>
143 <?php } if ($usp_recaptcha_public && $usp_recaptcha_private && $usp_recaptcha_display == 'show' && $usp_recaptcha_version == 2) { ?>
144
145 <fieldset class="usp-recaptcha">
146 <label for="g-recaptcha"><?php esc_html_e('Verification', 'usp'); ?></label>
147 <div id="g-recaptcha" class="g-recaptcha" data-sitekey="<?php echo esc_attr($usp_data_sitekey); ?>"></div>
148 </fieldset>
149 <?php } if ($usp_options['usp_images'] == 'show') { ?>
150 <?php if ($usp_options['max-images'] !== 0) { ?>
151
152 <fieldset class="usp-images">
153 <label for="user-submitted-image"><?php esc_html_e('Upload an Image', 'usp'); ?></label>
154 <div id="usp-upload-message"><?php esc_html_e($usp_options['upload-message'], 'usp'); ?></div>
155 <div id="user-submitted-image">
156 <?php // upload files
157
158 $usp_minImages = intval($usp_options['min-images']);
159 $usp_maxImages = intval($usp_options['max-images']);
160 $usp_addAnother = $usp_options['usp_add_another'];
161
162 if (empty($usp_addAnother)) $usp_addAnother = '<a href="#" id="usp_add-another" class="usp-no-js">'. esc_html__('Add another image', 'usp') .'</a>';
163
164 if ($usp_minImages > 0) : ?>
165 <?php for ($i = 0; $i < $usp_minImages; $i++) : ?>
166
167 <input name="user-submitted-image[]" type="file" size="25"<?php echo $usp_required; ?> class="usp-input usp-clone" accept="image/*">
168 <?php endfor; ?>
169 <?php if ($usp_minImages < $usp_maxImages) : echo $usp_addAnother; endif; ?>
170 <?php else : ?>
171
172 <input name="user-submitted-image[]" type="file" size="25" class="usp-input usp-clone" data-parsley-excluded="true" accept="image/*">
173 <?php echo $usp_addAnother; ?>
174 <?php endif; ?>
175
176 </div>
177 <input type="hidden" class="usp-hidden" id="usp-min-images" name="usp-min-images" value="<?php echo $usp_options['min-images']; ?>">
178 <input type="hidden" class="usp-hidden" id="usp-max-images" name="usp-max-images" value="<?php echo $usp_options['max-images']; ?>">
179 </fieldset>
180 <?php } ?>
181 <?php } ?>
182
183 <fieldset id="usp_verify" style="display:none;">
184 <label for="user-submitted-verify"><?php esc_html_e('Human verification: leave this field empty.', 'usp'); ?></label>
185 <input id="user-submitted-verify" name="user-submitted-verify" type="text" value="" data-parsley-excluded="true">
186 </fieldset>
187
188 <?php echo usp_display_custom_checkbox(); ?>
189
190 <div id="usp-submit">
191 <?php if (isset($usp_options['redirect-url']) && !empty($usp_options['redirect-url'])) { ?>
192
193 <input type="hidden" class="usp-hidden" name="redirect-override" value="<?php echo esc_url($usp_options['redirect-url']); ?>">
194 <?php } ?>
195 <?php if (!$usp_display_name) { ?>
196
197 <input type="hidden" class="usp-hidden" name="user-submitted-name" value="<?php echo esc_attr($usp_user_name); ?>">
198 <?php } ?>
199 <?php if (!$usp_display_email) { ?>
200
201 <input type="hidden" class="usp-hidden" name="user-submitted-email" value="<?php echo sanitize_email($usp_user_email); ?>">
202 <?php } ?>
203 <?php if (!$usp_display_url) { ?>
204
205 <input type="hidden" class="usp-hidden" name="user-submitted-url" value="<?php echo esc_url($usp_user_url); ?>">
206 <?php } ?>
207 <?php if (isset($usp_options['usp_use_cat']) && $usp_options['usp_use_cat'] == true) { ?>
208
209 <input type="hidden" class="usp-hidden" name="user-submitted-category" value="<?php echo esc_attr($usp_options['usp_use_cat_id']); ?>">
210 <?php } ?>
211
212 <input type="submit" class="usp-submit" id="user-submitted-post" name="user-submitted-post" value="<?php esc_attr_e('Submit Post', 'usp'); ?>">
213 <?php wp_nonce_field('usp-nonce', 'usp-nonce', false); ?>
214
215 </div>
216
217 </form>
218 </div>
219 <script>(function(){var e = document.getElementById('usp_verify'); if(e) e.parentNode.removeChild(e);})();</script>
220
221 <?php endif; ?>