News:

Looking for documentation? Take a look on our wiki

Main Menu

Redirect Joomla's registration page to VirtueMart

Started by Ventsi Genchev, August 10, 2017, 20:24:15 PM

Previous topic - Next topic

Ventsi Genchev

Hello everyone,

I use the registration form of Virtuemart and I do not have a published Joomla registration menu.
However, if I add the following to the URL address: "index.php?option=com_users&view=registration", opens the Joomla registration form. In my opinion, this means that it will be indexed by Google.
What I have decided to do is to modify the default.php file in the following way:
mysite/templates/theme/html/com_users/registration/default.php
defined('_JEXEC') or die;
$app = JFactory::getApplication('site');
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=user', false));


So everything works the way I want, but my question is whether there is no setup in the administration for this purpose that I miss?
Also, can I expect future problems?
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Milbo

$app = JFactory::getApplication('site');

remove the site. It has no effect, once the app is setup you get always the same app (creates a lot problems). But your idea should work. Expect always problems, when you mod the core, but it should work.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ventsi Genchev

Thank you for the advice, my friend. I removed the "site" from the code.
Well, template makers have overwritten the file anyway to fit the design. So there was a risk before my intervention. The important thing is that the change is not hardcoded.

Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

rage76

Dear Venci

I am glad you brought this up. I too use VM registration and have the same issue.

I checked the "default.php" in my template  but the code is different.

<form id="member-registration" action="<?php echo JRoute::_('index.php?option=com_users&task=registration.register'); ?>" method="post" class="form-validate" enctype="multipart/form-data">

How do you suggest I take care of this?

Ventsi Genchev

First make sure you overwrite a file in:
templates/YourTheme/html/com_users/registration/default.php

You need to delete everything from the file and leave only the following:
<?php
defined
('_JEXEC') or die;
$app JFactory::getApplication();
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=user'false));
?>
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

rage76

You are telling me to technically create a new file. But won't that cause other problems/issues? Since, the already existing file is a template override and must've been added for a reason.

There is a lot of code in this file and I am not a coder so I donot know what that does !!

Ventsi Genchev

I do not know what to say.  :)
You decide whether to change something or not. The file has been overwritten by template makers for some reason - changing styles or otherwise.
Perhaps if I had told you to add the lines at the top, you would have been more relaxed.  :)
This file is only used for Joomla registration. Once I only use Virtualmart registration, I do not see any reason for someone to open a Joomla registration page.

Quote from: rage76 on August 12, 2017, 07:51:34 AM
But won't that cause other problems/issues?
Of course. If you decide to use Joomla's registration, you will not be able to. When you change something, always expect problems.  ;)
Additionally, if Joomla changes anything in the registration code, it will not work because templates manufacturers have already overwritten a file. By the way, this is one of the main reasons that causes problems with Virtuemart, but many people forget or do not know how to test the problem.

This is the most harmless solution for me. If anyone wants, he can challenge it.
Of course, if you're worried about this, and if you want to achieve the described effect, you can install one of the many plugins that do that.
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

rage76

hmm...I think I will give it a try(on test site). I am already using the plugin to redirect to VM registration but that has not disabled the default URL.

Thanks.


rage76

#8
ok, I tried this on my local host and it worked without any issues and took me to "/index.php/signup" but on the live site; when I type the url

"/index.php?option=com_users&view=registration", it takes me to "/index.php/login" with a message "Please login first"

Any idea why?