Skip to content

Instantly share code, notes, and snippets.

@bhwebworks
Created January 28, 2012 02:01
Show Gist options
  • Save bhwebworks/1692086 to your computer and use it in GitHub Desktop.
Save bhwebworks/1692086 to your computer and use it in GitHub Desktop.
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