Subscriber not able to add image when adding an event

I've got a situation where we are using Events+ with front-end posting of events so users can add events.

The site is on a secure server behind a firewall, but I also have a duplicate on the internet here for troubleshooting. http://dev.prometheusfire.me/act-connect/

On the add event page http://dev.prometheusfire.me/act-connect/events-calendar/add-or-edit-event/

On this dev site the featured image upload works for subscribers, but stalls at crunching. Okay fine, I found that the Add Media button in TinyMCE works okay, but subscribers get the error "You don't have permission to attach files to this post."

It works fine for admins and I have a User Role Editor plugin installed and have given the right permissions to subscribers, but am having no luck in beating the error.

I've activated support access on the dev site. If you are able to discover a solution, please inform me of everything you did as I have manually carry them over to the live site on the internal server.

  • Michelle Shull

    Hello, Saunt Valerian!

    I did some testing, and I don't think it's a permissions issue. Let me tell you what I did. (Also, so you can delete the subscriber, event, and image I added before you port back to the production site.)

    I added a subscriber user, WPMU Michelle, and logged in via an incognito browser window.
    I added an event as that subscriber, and tried to upload a featured image.
    Like you, I got stuck at "crunching" put when I hit "save changes" I found the image I had uploaded (a baby panda .gif) in the media library, and I could add it to my event from there.

    This tells me almost the entire process is working as it should. Something is going wrong between when the image is uploaded successfully and when the user is told it worked. This makes me think there's a plugin conflict somewhere. I'm pretty sure you know the drill here, but just in case it's new to you, here's our guide: https://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    Can you run through the steps in the manual and see if anything pops up? If you find something, it doesn't necessarily mean we can't make it work, but we'll have a better idea of where to look.

    Thanks!

    The Event I created is called, imaginatively enough, This is a Test Event. If you can leave the subscriber user I added, WPMUMichelle, until we get this sorted, that would be handy, but you can delete the event and the adorable baby panda.

    Also, I think you may also have an issue with email. I never got the "send this user the password by email" email that should have triggered when I made a new user account for myself. Did you get email notification when that user was created?

    Thanks!

  • Saunt Valerian

    Michelle, thanks for looking into this. I'm aware of the plugin conflict possibility (there are a lot of plugins on that site). That process you described is for the featured image - did you try it the other way too? Up top, using the Add Media button in the TinyMCE section? It look like a different kind of error on at that one, can you take a look there too? It tries to upload and never gets to the crunching to stall - it simply errors out with the permissions warning pretty much immediately.

    I'm going to do the plugin conflict dance (that's what I like to call it) once I get enough time to get through it all, but I'm wondering about other error.

    Also, don't worry about that email notification thing, this site is a little weird because we have an Active Directory plugin installed, it hijacks everything. We can make changes as we see fit to this site, I just need to document them. This site won't be ported over, it is for testing and troubleshooting only. When I change things, there is no scripting to move it to the live site, it's a fully manual process because of security restrictions.

  • Michelle Shull

    Hello Saunt Valerian!

    I see the issue you're seeing there, as well. It seems to fully upload, then *poof*, it disappears and I see the permissions error. I double checked, that image never made it into the media library. This may in fact be a permissions issue.

    My colleague @Ashok suspected this, as he is wise, let me call him back in. He may have some script wizardry that can allow this to work for you. It may be related to the other issue, so check on the Add Media option when you're checking on uploading a featured image during your plugin test.

    Thanks! And thanks for the background on the site, too. I have a sandbox site that's full of quirks, it's never a dull experience. :slight_smile:

  • Vinod Dalvi

    Hi Saunt,

    I could confirm the issue on my test site using latest version of Events + plugin that thr subscriber users are getting error message "You don't have permission to attach files to this post." as shown in the attached screenshot when they try to upload image for the event from front end.

    It's working fine for them when they upload image from admin area.

    I have notified this to the plugin developer so that it can be fixed. The issue will be fixed ASAP.

    In the meanwhile the issue can be fixed by using the following custom code.

    add_action('init', 'allow_subscriber_uploads');
    function allow_subscriber_uploads() {
        $subscriber = get_role('subscriber');
        $subscriber->add_cap('upload_files');
        $subscriber->add_cap('edit_published_pages');
        $subscriber->add_cap('edit_others_pages');
    }

    I have added the above code in the functions.php file of your ACT Newsline child theme and confirmed the image uploading is working fine now on your site for subscriber users.

    Could you please check it and let me know how it works for you?

    Best Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.