From 727f1a2082fa20b84a03f2e74093992222549535 Mon Sep 17 00:00:00 2001 From: Andy Gaskell Date: Mon, 17 Jul 2017 00:04:58 +0100 Subject: [PATCH] Switch from depricated Joomla function I found a bug with the code for the latest joomla version. This seems to stem, I think, from the deprecation of the JFactory::getURI(); function. It should, I think, be changed to the JUri::getInstance(); function. This bug means the return URL is not correct when saving a new item for the first time. There is some discussion about JFactory::getURI(); versus JUri::getInstance(); on https://joomla.stackexchange.com/questions/4294/get-the-current-joomla-url I'll try to find some more formal notes or docs about this though. This seems to only be an issue on Joomla! 3.7.3 and later, also is, I think, only an issue when creating items in the front end. Sorry, this really needs more details, version info and background, but I thought I'd jot some initial notes anyway, and add more later. --- admin/extensions/system_fieldsattachment/fieldsattachment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/extensions/system_fieldsattachment/fieldsattachment.php b/admin/extensions/system_fieldsattachment/fieldsattachment.php index 647aacb..bedc98a 100644 --- a/admin/extensions/system_fieldsattachment/fieldsattachment.php +++ b/admin/extensions/system_fieldsattachment/fieldsattachment.php @@ -1238,7 +1238,7 @@ function onAfterRender() //$uri = $_SERVER["HTTP_REFERER"]; $user = JFactory::getUser(); $userId = $user->get('id'); - $uri = JFactory::getURI(); + $uri = JUri::getInstance(); $uri = 'index.php?option=com_content&task=article.edit&a_id='.$id; $app = JFactory::getApplication(); $app->setUserState('com_content.edit.article.id',$id);