Fix [login to view URL] to allow it to work for front end wordpress posting script

Stängt Publicerat 6 månader sedan Betalades vid leverans
Stängt Betalades vid leverans

I am looking for a developer to fix the issue with [login to view URL] for my front end WordPress posting script. The specific issue I am experiencing is that it is not uploading files. The issue seems to be related to dropzone trying to upload files before the post is submitted but wordpress doesnt process anythign until a post is submitted. I dont care if you make dropzone just a fancy uploader, provide a similar solution, or if you can make dropzone work as intended I just need users to be able to upload files and then upload more before submitting.

Requirements:

- Experience with [login to view URL] and WordPress

- Familiarity with the latest version of WordPress

- Ability to troubleshoot and fix issues related to file uploading

Here is the relevant code. If you see the issue. Let me know and I'll pay you to resolve it. I'm not going to share file access and deal with a ton of debugg on this.

function usp_enqueue_scripts() {

global $post;

if (is_a($post, 'WP_Post') && has_shortcode($post->post_content, 'users-submit-posts')) {

wp_enqueue_editor();

wp_enqueue_script('dropzone', '[login to view URL]@5/dist/min/[login to view URL]', [], false, false);

wp_enqueue_style('dropzone-css', '[login to view URL]@5/dist/min/[login to view URL]');

}

}

add_action('wp_enqueue_scripts', 'usp_enqueue_scripts');

<div id="dropzone" class="dropzone"></div>

<input type="submit" name="submit-post" value="Submit Post">

<script type="text/javascript">

[login to view URL] = false;

var myDropzone = new Dropzone("#dropzone", {

url: "/wp-admin/[login to view URL]",

autoProcessQueue: false,

addRemoveLinks: true,

maxFiles: 10,

acceptedFiles: "image/*",

params: {

action: 'handle_dropzone_upload'

}

});

[login to view URL]('usp-form').addEventListener('submit', function(e) {

[login to view URL]();

var formData = new FormData(this);

[login to view URL]('action', 'usp_handle_submission'); // Specify the action name

[login to view URL](function(file) {

[login to view URL]('user-submitted-cover-photos[]', file);

});

[login to view URL]({

url: '/wp-admin/[login to view URL]',

type: 'POST',

data: formData,

processData: false,

contentType: false,

success: function(response) {

[login to view URL](response); // Debugging line

if(response && [login to view URL] && [login to view URL] && response.data.redirect_url) {

[login to view URL] = response.data.redirect_url;

} else {

[login to view URL]('Unexpected response:', response);

}

},

error: function(jqXHR, textStatus, errorThrown) {

[login to view URL](textStatus, errorThrown);

}

});

});

</script>

/**

* Handles the post submission process once the form is filled and submitted by the user.

* It validates the form, creates a new post, handles media uploads, saves custom fields, and redirects the user to the newly created post.

*

* @hooked init

*/

function usp_handle_submission() {

if (usp_is_form_submitted()) {

$post_id = usp_create_post();

if (is_wp_error($post_id)) {

wp_send_json_error(array('error' => $post_id->get_error_message()));

exit;

}

if (isset($_FILES['user-submitted-cover-photos'])) {

usp_handle_media_uploads($post_id, $_FILES['user-submitted-cover-photos']);

}

usp_save_custom_fields($post_id);

wp_send_json_success(array('redirect_url' => get_permalink($post_id)));

exit;

}

}

add_action('wp_ajax_usp_handle_submission', 'usp_handle_submission'); // Hook for logged-in users

add_action('wp_ajax_nopriv_usp_handle_submission', 'usp_handle_submission')

/**

* Checks if the post submission form has been submitted and if it's a valid submission.

*

* @return bool True if form is validly submitted, false otherwise.

*/

function usp_is_form_submitted() {

return isset($_POST['submit-post'], $_POST['_usp_nonce'])

&& wp_verify_nonce($_POST['_usp_nonce'], 'usp_handle_submission')

&& is_user_logged_in();

}

/**

* Creates a new post based on the data submitted in the form.

* The post title and content are sanitized. The post is set to 'pending' status by default and assigned to category ID 94.

*

* @return int|WP_Error Post ID on success, WP_Error on failure.

*/

function usp_create_post() {

// Create post object

$new_post = array(

'post_title' => sanitize_text_field($_POST['user-submitted-title']),

'post_content' => wp_kses_post($_POST['user-submitted-content']),

'post_status' => 'publish', // You can set to 'publish' if you want to publish immediately

'post_type' => 'post', // Change this to your desired post type if different

'post_author' => get_current_user_id(),

'post_category' => array(94) // Assigning to category with ID 94

);

return wp_insert_post($new_post);

}

jQuery WordPress PHP

Projekt-id: #37355394

About the project

21 offerter Distansprojekt Aktivt 5 månader sedan

21 frilansare har lagt bud på i genomsnitt $32 för det här jobbet

DestinyGuider

i am ready to start now kindly share your site url will fix it within 20 mins INSHA ALLAH and its not an AUTO BID

$30 USD inom 1 dag
(195 omdömen)
7.0
caciocode

Hi, I am a Wordpress developer. I can fix the upload issue on your website.

$30 USD inom 1 dag
(365 omdömen)
7.2
ShrineWeb

I have a few queries regarding the specifications that you have provided. Could we please have a word? My Skills: jQuery, PHP and WordPress

$10 USD inom 10 dagar
(182 omdömen)
7.2
mamunstudios

Hello there, it is possible to upload any file before post submitted . I need to know that, are you uploading multiple files or single file ? I have solution for that and if you want to change the uploading system that Mer

$40 USD inom 2 dagar
(86 omdömen)
6.1
mobimubasir

Hello. I read your requirement i will do that. Please come on chat we will discuss more about this. I will waiting your reply.

$20 USD inom 1 dag
(12 omdömen)
3.7
navisohal162

Hello, I understand that you wish to resolve the issue with file uploading in your WordPress posting script using dropzone.js. With experience in both technologies, I can troubleshoot and fix this problem. Please s Mer

$20 USD inom 7 dagar
(5 omdömen)
3.3
ndambukiboniface

Greetings Dear Client, Welcome to my profile, Home to Professional and Quality services with 100% customer satisfaction guarantee. I'm a Certified & Experienced Expert in the respective project requirements. Dear Clie Mer

$30 USD inom 1 dag
(0 omdömen)
0.0
Davidcole20061

Hello, there. I hope you are doing well. I have just read your project. I have confidence to fix your project I have mastered many FrontEnd and Backend Developing languages but I specially focused on HTML, CSS, PHP,Wo Mer

$20 USD inom 7 dagar
(0 omdömen)
0.0
manoharghl

Hello, I Develop PHP Websites from scratch Customize the existing ones or Fix errors for your current website in Laravel, CodeIgniter, WordPress, Ecommerce, and Core PHP. What Do I Offer? PHP Scripting Front End D Mer

$20 USD inom 7 dagar
(0 omdömen)
0.0