Support » Networking WordPress » Media Uploader issue

  • I have WP MU and I have a page on main domain from where blog admins can update/manage their pages/posts. so it looks like: On that page I am check if user is blog admin and I am gathering infos I need and doing this:

    wp_enqueue_media( array( 'post' => $post_id ) );
    wp_editor( $post_content, 'post_content', $settings = array(textarea_rows => 15, media_buttons => true) );

    $userblog_id is actually ID of the blog that user is assigned to. $post_id is ID of the post that user is editing on member page.

    Now when blog admin clicks on Upload Media button it shows media upload popup, but the media gallery is always empty and when admin tried to upload something it is always failing with this error “An error occurred in the upload. Please try again later.”

    I saw that is called when I click Add Media button and that json response is: {“success”:false}

    Now when I am logged in as superadmin – it works properly.

    Does anybody have an idea what’s wrong here ?

Viewing 15 replies - 1 through 15 (of 17 total)
  • ..Forgot to mention when I go to the site dashboard for that blog and click Add media button – admin-ajax.php response is :

    So obviously even if I am logged in as blog admin on main site – I am not getting authenticated as blog admin when ajax request is run on ? Is there a work-around ?

    I have WP MU and I have a page on main domain from where blog admins can update/manage their pages/posts.

    Just to be clear… are they editing their pages/posts on OTHER SITES or on the main domain?

    They are editing their own pages/posts (mine setup is only one username/admin per blog).It’s subdomain setup, so I guess it may be some kind of domain policy issue when they have to upload from “main domain” members page ? I am not sure if switch_to_blog($userblog_id) is working properly when ajax calls are running ? And i’m not that good in Ajax 🙁

    If a user isn’t added to a site (blog) then they can’t post TO that blog, hence my asking if they’re posting to site #1 (the main site) or their own.

    OK, I see your point 🙂 Do you have any ideas why ajax isn’t authenticating requests ?

    My wild guess is that it’s ajax/same domain policy issue ? I am doing switch_to_blog() call and that part is ok (like post/page are updating etc…), but since that call is coming from and is trying to upload to I guess that in that part the conflict occurs (for ajax and are completely different domains) – am I right ? and are separate domains and require separate cookies. would be able to use the same cookies and not require re-authentication, so that’s certainly going to be a problem.

    Well, that’s the thing I’m confused with – all users (and user is blog admin as I have only one user per blog and that user is blog admin), so all admins are also logging via and all cookies are set there.

    I know all cookies are good because after login on main site I can go to and I am logged-in as admin, and from there I can use wp normally ( wp uploader as well 🙂 )

    Only issue I have is with media uploader on main blog ( is location) -> how to “explain” to that ajax call that user is admin and that he is logged in and that all is OK as it seems to me that ajax can’t figure out that user is legit – hence it’s denying access 🙁

    Unless you set up cookieless domains, or cross-domain permissions, it’s not actually working the way you think it is.

    Cookies are not shared between subdomains. Browsers don’t let you. You’re actually logged in twice, once on each domain/subdomain.

    Well – I’m not sure what’s best to do as I’m new to WP MU – can you point me in right direction now ? What should I do to make this uploader work with setup I have… How do I alter cross-domain policy ?

    Best? Let people actually use WordPress as intended. Let them go in and edit their sites like they are what they are: Separate sites.

    Second Best would be to go to each site to have the per-site uploader/front end writer you seem to have crafted.

    But this is based on the very limited explanation of ‘why’ you’ve given, that is to say you have not explained why you want to do this 🙂 Believe it or not, understanding why you’re doing something, the purpose of the end goal, may help people find workarounds.

    Well, I wouldn’t be bothering my self to do something if I don’t have to, right 🙂

    The goal is that all admins will go to one page on my main domain and manage their respective sites from there. They won’t have that many options as they have in WP – only basics one like: write page/post and delete/edit, create category and upload media to the post, change profile info and that’s about it.

    Anyway – I couldn’t find the right solution for this, so I’ll just write my own media uploader…

    What if I told you there were plugins that would, on wp-admin, limit them to just being able to write posts, create categories, and upload media? So instead of reinventing the wheel, you could lock things down?

    Mind you … why do you want them to not have that access and own their own sites? With Multisite, that’s way overkill. What do they actually need separate SITES for if they’re not using them as admins?

    Hi Ipstenu and thanks for your time helping me out, but my users are mostly elderly people or people with no computer experience what-so-ever, and I really have to make this system easy to use.

    I did more than 100 WP sites – never did the MU – this is my first one so I know that there are a lot of plugins and I can use roles and stuff – I know all that, but this is the road i have to go – my custom backend on main site, and I am almost done 🙂

    I am kind of baffled that there is no work-around to solve ajax cross-domain media-uploader issue.

    Once again thanks for your time and effort – I appreciate it 🙂

    Moderator Bet Hannon


    Support Team Volunteer Wrangler

    I had a similar situation with a very tech-averse client, and to keep things super-simple for him, I created a password protected page for him with a Gravity form where he could input his posts without freaking out on the dashboard.

    Gravity Forms allows you to use Post Fields, where the entries can be automatically assembled into posts–including title, body, tags, categories & images.

    What if you did that on your main site, then set up notification emails through the Gravity routing feature (based on their inputted email or a username) to post to the correct subsite, using WP’s post-by-email feature?

    Complex, but keeps your users calm?

    Post-By-Email and Multisite aren’t the best of friends.

    Why can’t they go to their own special page per site, though? I mean, you would reduce your complexity just by saying ‘To post on, go to’ and so on.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Media Uploader issue’ is closed to new replies.