Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Contact form Invalid Token patch
if ($user->get('id') || ($viewnow == 'category' && $viewcache == 0)) {
$view->display();
} else {
+
+ // Workaround for token caching
+ if ($viewName == 'contact')
+ {
+ ob_start();
+ }
+
$option = JRequest::getCmd('option');
$cache =& JFactory::getCache($option, 'view');
$cache->get($view, 'display');
+
+ // Workaround for token caching
+ if ($viewName == 'contact')
+ {
+ $contents = ob_get_contents();
+ ob_end_clean();
+
+ $token = JUtility::getToken();
+ $search = '#
#';
+ $replacement = '
';
+
+ echo preg_replace($search, $replacement, $contents);
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment