PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Path errors on preview.php

  1. First, I'm loving this plugin. Tried to view a preview and got

    Warning: require_once(C:\xampplite\htdocs\wpmu\wp-blog-header.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampplite\htdocs\wpmu\wp-content\plugins\gravityforms\preview.php on line 7
    
    Fatal error: require_once() [function.require]: Failed opening required 'C:\xampplite\htdocs\wpmu\wp-blog-header.php' (include_path='.;C:\xampplite\php\PEAR') in C:\xampplite\htdocs\wpmu\wp-content\plugins\gravityforms\preview.php on line 7

    As you can tell, I'm running MU on a XAMPP windows setup (XP)

    Your code is actually on line 2, but I tried a fix (see below) whiich is now commented out.
    Anyway, I tried (ABSPATH . "wp-blog-header.php"), but it returned the same warning like ABSPATHwp-blog-header.php. This warning made me think it's not reading the ABSPATH.

    So much for my solution. Any ideas? This one should be simple. Oh, my setup has wp-config and htaccess in root and a /core directory with everything except wp-content which is in root.

    Posted 14 years ago on Tuesday December 29, 2009 | Permalink
  2. wp-blog-header.php is a core WordPress file that is typically in the root. In your case if you have moved the core files into a directory called /core then in order to get the wp-blog-header.php it's going to have to path to that folder.

    Try adding core/ in front of wp-blog-header.php, and let me know what happens.

    While our pathing to files such as javascript calls, etc. rely on a WordPress function to get the correct path, this is an area that does not use that function. We will look at what can be done about that as this isn't the typical install scenario so it's not something that has come up.

    Posted 14 years ago on Tuesday December 29, 2009 | Permalink
  3. After some debugging, I found that ABSPATH wasn't defined at this point for some reason, so I solved the problem this way:

    $local_path = $_SERVER['DOCUMENT_ROOT'].'/wpmu/core/';

    and then this

    require_once ($local_path . "wp-blog-header.php");
    require_once ($local_path. "wp-admin/includes/admin.php");

    This should work even after loaded to the production server (I hope)

    Now I have to figure out why your original file didn't work because this will get broken when I update GF.

    Posted 14 years ago on Thursday December 31, 2009 | Permalink
  4. We can also look into it on our end next week and see what we can do so that this fix is native to Gravity Forms.

    If you find anything out, let us know. In the mean time make the change, then what you can do is just keep track of your change so until we have a native fix... you can re-apply your patch when we release an update.

    Posted 14 years ago on Thursday December 31, 2009 | Permalink
  5. Yeah, after two fixes, I created a .xls file with plugin, path_to_file, line # and change description as fields. I add the code for the patch as a comment. Hopefully that will keep it organized if I need this for the upgrade.

    Posted 14 years ago on Thursday December 31, 2009 | Permalink

This topic has been resolved and has been closed to new replies.