Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Redirect after edit to origin #24109

Closed
coolcat-creations opened this issue Mar 6, 2019 · 14 comments
Closed

[4.0] Redirect after edit to origin #24109

coolcat-creations opened this issue Mar 6, 2019 · 14 comments

Comments

@coolcat-creations
Copy link
Contributor

What needs to be fixed

When something is edited from a shortcut link, for example like here: #23934 the user should be redirected to the origin he came from

If you edit the module and close it, you end up in the module manager. It would be good to implement a refererlink on such icons so when you close something you get back to where you came from.

@infograf768 tagging you because of your + vote ;)

@infograf768
Copy link
Member

infograf768 commented Mar 8, 2019

This change works fine here for #23934

diff --git a/administrator/components/com_modules/tmpl/module/edit.php b/administrator/components/com_modules/tmpl/module/edit.php
index 6ed075f..8a076bb 100644
--- a/administrator/components/com_modules/tmpl/module/edit.php
+++ b/administrator/components/com_modules/tmpl/module/edit.php
@@ -15,4 +15,5 @@
 use Joomla\CMS\Layout\LayoutHelper;
 use Joomla\CMS\Router\Route;
+use Joomla\CMS\Uri\Uri;
 
 HTMLHelper::_('behavior.formvalidator');
@@ -198,4 +199,10 @@
 		<?php echo $this->form->getInput('module'); ?>
 		<?php echo $this->form->getInput('client_id'); ?>
+
+		<?php // Redirect to CPanel when the module has been edited from there. ?>
+		<?php $url = htmlspecialchars($_SERVER['HTTP_REFERER']); ?>
+		<?php if ($this->item->client_id == 1 && ($url == Uri::root() . 'administrator/index.php' || $url == Uri::root() . 'administrator/index.php?option=com_cpanel')) : ?>
+			<input type="hidden" name="return" value="<?php echo base64_encode('index.php?option=com_cpanel') ?>">
+		<?php endif; ?>
 	</div>
 </form>

I guess we also could use a code using session.
Not sure what is the best solution

@coolcat-creations
Copy link
Contributor Author

Ok I guess after the edit is merged I or @C-Lodder can add this "fix" to the module or should this fix be done to all possible places? Then the places should be maybe listed.
I can think of - edit userprofile ... but which else?

@infograf768
Copy link
Member

we must first decide if we should use that kind of code or not.

@infograf768
Copy link
Member

after some discussion, that code is not the right way.
will test another and, if it works fine, will make pr

@infograf768
Copy link
Member

I wait for @C-Lodder pr to be merged to propose the patch as the main change is in fact in the url in modules.php

@coolcat-creations
Copy link
Contributor Author

Thank you :)

@infograf768
Copy link
Member

Please test #24109 for the CPanel modules

@ghost
Copy link

ghost commented Mar 21, 2019

@infograf768 #23934 to test.

@joomla-cms-bot
Copy link

Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/24109

@ghost
Copy link

ghost commented Mar 21, 2019

closed as having Pull Request #23934

@infograf768
Copy link
Member

@franz-wohlkoenig
#23934 was merged and that is why I could make the new PR :)

I reopen this as it did not only concern the cpanel modules but eventually other places in core where the redirect would be nice to implement.

Please, all, state which precise places.

@infograf768 infograf768 reopened this Mar 21, 2019
@infograf768
Copy link
Member

@chmst
Also proposed for Edit Account
#24281

@ghost ghost added the J4 Issue label Apr 4, 2019
@brianteeman
Copy link
Contributor

This should be closed. The original issue has been resolved as have lots of other similar "return to origin" issues. If there are any new links that need to "return to origin" then they should be in their own new issue/pr

@ghost
Copy link

ghost commented May 20, 2019

closed as stated above.

@ghost ghost closed this as completed May 20, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants