We are creating a theme that allows front-end dragging and dropping of portions of the screen. Our theme relies on AJAX calls that (re)render portions of the screen to get an 'ultimate' user experience. Ofcourse each AJAX call automatically 'DEFINES' the DOING_AJAX.
It appears when the theme re-rendering a portion of the screen that contains a nggallery shortcode, the webservice throws a 500 error;
-------- error log
PHP Fatal error: Call to a member function get_permalink() on a non-object in /var/www/html/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 289
-------- line 289 of nggfunctions:
$gallery->slideshow_link = $nggRewrite->get_permalink(array ( 'show' => 'slide') );
-------
When inspecting the NextGen code I see this is NOT a bug in the code; it appears the rewrite.php is intentionally left out for optimization reasons;
-------- (line 336 of nggalery.php)
// We didn't need all stuff during a AJAX operation
if ( defined('DOING_AJAX') )
require_once (dirname (__FILE__) . '/admin/ajax.php');
else
{
// include other files among which rewrite.php
--------
It appears including the rewrite.php file would fix our problem:
// We didn't need all stuff during a AJAX operation
if ( defined('DOING_AJAX') )
{
require_once (dirname (__FILE__) . '/admin/ajax.php');
require_once (dirname (__FILE__) . '/lib/rewrite.php'); // 71.936 <--- adding this line helps us out
}
else
{
... no modifications here
}
Here's a screen recording I made to show you what we try to accomplish (here I patched the file)
http://screencast.com/t/apOZvBuvxl
------
Any suggestion would be welcome :)
Thanks