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.php

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

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