Home › Forums › Front-end Issues › Frontend form – custom role can't upload picture
Hi everyone,
I have been looking for days for this issue and I can’t find out what is wrong …
I’m running the lastest version of WordPress and ACF, I also have ACF Repeater.
I have a form in frontend and the user role I created (etudiant) can edit all the fields (it is a Custom Post Type) … But when I try to upload a picture I have an error “Please try again.”.
Though, if I do the same but in the backend of WordPress, there is no error and it is working perfectly, same thing if I try to edit from the frontend with an Admin user.
So basically it is not working only when it is the role I want in the frontend.
Any suggestion? Of course I already tried removing all plugins and I even gave all the capabilities to the custom role but it wouldn’t work as well (weird).
Hi @charlotte83
This could potentially be a JS error which may be solved by updating to the latest ACF via github.
There are some updates to the JS which help prevent these errors on front end form.
Please download and test. Let me know what you find?
Thanks
E
Hi Elliot,
I just tried that but unfortunately this isn’t working.
I turned on the WP_DEBUG but I don’t have anything on the Console so I don’t know what could be wrong …
It’s becouse guest cannot upload anything to wordpress. I think how i can allow them to upload files to some front end form… Someone had some ideas?
Hi Trasek,
thanks for your answer but as I said I created a custom role (etudiant) and they have the upload_media, edit_projet (my custom post type) and read permissions, so I don’t think this is the issue.
Any other idea?
Hi @charlotte83
The PHP error should be visible in the JSON data returned when you upload a file.
Thanks
E
Hi Elliot,
I didn’t have any error but I finally manage to make it work 🙂
Thanks to this :
http://wordpress.org/support/topic/solving-wp-media-upload-in-the-frontend-and-tml?replies=4#post-4851176
And I also had to delete and re-create my custom role (no idea why but it worked).
Thanks for you help !
Hi, Same problem here. Not sure how this worked. I am not using the plugin https://wordpress.org/plugins/theme-my-login/ so where and how the codes should go?
File upload works fine from backend when logged in as a user.
I changed the user permission to below:
add_action('wp', 'allow_employer_uploads');
function allow_employer_uploads() {
$employer = get_role('employer');
// author caps
$employer->add_cap('edit_published_posts');
$employer->add_cap('delete_posts');
$employer->add_cap('edit_posts');
$employer->add_cap('upload_files');
// editor caps
$employer->add_cap('edit_others_posts');
}
Thanks
The topic ‘Frontend form – custom role can't upload picture’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.