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