There seems to be a conflict with the All-in-One Event Calendar by Timely plugin. The error message goes away when I deactivate that plugin. However since this site is live and requires the functionality of both plugins – I tried commenting out the line that is prompting the error (266):
global $post; $post->permalink = $permalink; $url = add_query_arg(array());
The error went away and everything is still working but this clearly isn’t a long term solution. Any advice?
@jules2000,
I am having the exact same issue with a different events plugin: Event Espresso
I found the same thing, if I comment out that line then the error goes away, although right now I have no idea how this would affect my directories. I believe the function that this is in is canonical_directories… If I can trace that down and see what function that serves then maybe I can figure out a work around. I’ll let you know.
I added this as a fix, and it seems to work…
global $post;
// Had to nest this in order to avoid conflicts with other plugins
if($post != null) {
$post->permalink = $permalink;
$url = add_query_arg(array());
$sentPostID = is_object($sentPost) ? $sentPost->ID : $sentPost;
// $post->ID === $sentPostID is so that add_query_arg match doesn't apply to prev/next posts; just current
preg_match('/('.sanitize_title(apply_filters('kws_gf_directory_endpoint', 'entry')).'\/([0-9]+)(?:\/|-)([0-9]+)\/?)/ism',$url, $matches);
if(isset($post->ID) && $post->ID === $sentPostID && !empty($matches)) {
return trailingslashit($permalink).$matches[0];
} elseif(isset($post->ID) && $post->ID === $sentPostID && (isset($_REQUEST['leadid']) && isset($_REQUEST['form'])) || !empty($matches)) {
if($matches) { $leadid = $matches[2]; $form = $matches[1]; }
else { $leadid = $_REQUEST['leadid']; $form = $_REQUEST['form']; }
return add_query_arg(array('leadid' =>$leadid, 'form'=>$form), trailingslashit($permalink));
}
return $permalink;
}
Hopefully this doesn’t hamper the use of the directory…
I should note that this was in the gravity-forms-addons.php file at line 266. I wrapped almost everything in a condition that checks for a post object.
Needs one more bracket –> } at the end or will bomb out.
Also, the only time I received the error was when I have all in one event calendar enabled, turn that off and the error goes away. It’s NOT with all in one event calendar, but instead with Gravity Forms Directory, but the solution jhoffmcd offers solves that problem.
Thanks!