• Resolved vickyayala

    (@vickyayala)


    Hello,

    I am using TDO Mini forms in WordPress Multisite and it works fine. However, when I mapped a blog on the network to a custom domain name, I can’t get the attach image feature to work with the form. On the front end, the browse button works. However when the form is sent, no image is actually attached to the post.

    Is this a quirk for TDOMF and WordPress Multisite or is there a hack to work around this issue?

    Has anyone had the same problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Is it activated network wide or per site?

    I had it working on a MultiSite with it activated ONLY on one site, and it worked okay.

    max_Q

    (@max_q)

    Yes, I am having the same problem. I have a sub-folder MultiSite installation with domain mapping and two blogs. After enabling verbose logging, and adding additional code to track the process, what appears to be happening is the upload from the form on my sub-site (blog id 2) is failing quietly at “Attempting to create directory”. This is after uploading to the tmp area on the server and before creating the temporary storage area to hold the file. There is no error message, just a single “0” in the log on the line following “Attempting to create directory”. This doesn’t appear to be a server permissions issue, because when uploading from the main site (blog id 1) of my multisite install the plugin writes to (almost) the same area with no issue. Also, I’m getting no errors. The process just terminates.

    Another worrying problem, which may be responsible for this failure, is that when the file upload process is initiated, in the log the user changes from my current logged in username on my sub-site to my other logged in username on my main site. In fact, if I log myself out of my main site, log in on my sub-site and try to upload a file (on a form which is set to only allow logged in users to see it) I get a “Someone with no permissions tried to access the inline-upload form!” error in the log and “TDOMF: Bad permissions” in the iframe on my form. This problem is confirmed by querying WordPress for the current_user user_login and and ID during the upload, which returns either the user logged in to the main site, or “0” if there is no user logged in to the main site. In addition, the directory that TDOMF tries to create (which fails) is named after the logged in user on my main site, not the current user logged in to my sub-site.

    As soon as the tdomf-upload-inline process fails the user in the log (and in the current_user variable) returns to the correct current user on my sub-site. It seems like tdomf-upload-inline.php is operating in the context of a plugin on my main site, at least when it comes to users.

    Could you let me know if you see the same? BTW, it’s network activated, created it’s tables successfully, and as far as I can tell has no other issues with multisite.

    max_Q

    (@max_q)

    For @vickyayala and anyone else having this problem using TDO Mini Forms on a sub-site of a domain mapped, subfolder install multisite. The two problems I had above were independent and unrelated.

    The first problem was TDOMF switching to run in the context of a user on the main site instead of the sub-site during a file upload. I’m not sure the precise cause of this problem, but I think it comes down to the fact that the file upload portion of the form is basically a web page running in an iframe. That webpage is called, and it’s upload action is directed to, a url defined on line 345 of tdomf.php by the constant TDOMF_URLPATH using get_option(‘siteurl’). That function expands to http://www.mainsite.com/subsite on my installation, followed by the rest of the path to tdomf-upload-inline.php. My guess, and it’s just a guess, is the TLD is being echoed in the headers of the upload page and so it runs in the context of the main site. Whatever, I got it working by replacing the reference to TDOMF_URLPATH with home_url() in two places in the files responsible for file uploads;
    $inline_path = home_url() . '/wp-content/plugins/'.TDOMF_FOLDER.'/tdomf-upload-inline.php'.'?tdomf_form_id='.$tdomf_form_id.'&index='.$postfix;
    around line 570 in tdomf-upload-functions.php, and
    $tdomf_upload_inline_url = home_url() . '/wp-content/plugins/'.TDOMF_FOLDER.'/tdomf-upload-inline.php';
    around line 100 in tdomf-upload-inline.php. The function home_url() expands to http://www.subsite.com on my mapped installation, and it corrected the plugin’s confusion.

    As far as the second problem, failing at “Attempting to create directory”, that was caused by turning on “Enable Extra Log Messages” under “Debug” to try to troubleshoot the first problem. Checking that option enables a whole block of code related to debugging servers with Safe Mode enabled (which mine has), and that block of code, in my case, stops the directory creation process dead in it’s tracks. Fails without even an error message (other than “0”) in the log. Maybe because it uses realpath(), which needs executable permissions on all directories in the hierarchy. Don’t ask how long it took to find that out. That’s one week of my life I’ll never get back.

    Disclaimer: Don’t take this as gospel, I’m just a monkey poking at the code with a stick. In this case I got it to work. YMMV. Good Luck.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unable to attach an image with TDO Mini Form on a mapped domain’ is closed to new replies.