How to disable automatic login to Virtuemart after registration?

Started by mirovic, April 22, 2012, 17:02:05 PM

Previous topic - Next topic

drejk

Simple solution (VirtueMart bug?)

in administrator/components/com_virtuemart/models/user.php, in function store(), line approx. 494, change
$user = JFactory::getUser();
to
$user = new JUser;

(works on 2.0.14)

Stonedfury

No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

Stonedfury

Quote from: pbc278 on June 15, 2012, 01:39:52 AM
Quote from: pbc278 on June 15, 2012, 01:27:55 AM
then you can see the return of this part sould be the login action, but the line '$return = $mainframe->login($credentials);' does not do anything, change it also to:

This part was correct, sorry, did not know do a 'return' this way...
I was learned to write "return bla bla bla;" and not "$return = bla bla bla;"

sorry  :-[
Has anyone else tried this? I don't mind the customer being logged in after registering as that just makes it simpler. But not being logged in completely is a problem.

VM should get along with joomla not the other way. Joomla is by far a superior and more reliable product so why not use their standards literally.

This is what my user.php has
if($currentUser->guest==1){

$msg = (is_array($ret)) ? $ret['message'] : $ret;

$usersConfig = JComponentHelper::getParams( 'com_users' );

$useractivation = $usersConfig->get( 'useractivation' );

if (is_array($ret) and $ret['success'] and !$useractivation) {

// Username and password must be passed in an array

$credentials = array('username' => $ret['user']->username,

  'password' => $ret['user']->password_clear

);

$return = $mainframe->login($credentials);

}

The user is not being logged into joomla but they are logged in. We did a customer over the phone today and I watched as they checked out and they were never logged in and still show as "logged in - Never" I have searched for the code if($currentUser->id==0){ and it doesn't exist in that file so I am hoping to be safe in assuming that the VM devs tried to fix it but still failed. :(
My VM is 2.0.20b joomla 2.5.9 php 5.3
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

jenkinhill

I want all shoppers to be logged in to VM immediately so they can complete the purchase without being put off. To get users registered in Joomla too the solution for most people is here: http://forum.virtuemart.net/index.php?topic=113802.0    No need to hack any core files.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Stonedfury

Quote from: jenkinhill on March 22, 2013, 10:17:34 AM
I want all shoppers to be logged in to VM immediately so they can complete the purchase without being put off. To get users registered in Joomla too the solution for most people is here: http://forum.virtuemart.net/index.php?topic=113802.0    No need to hack any core files.
Thank you Jenkin! I will give this a shot as I agree I want them to be logged in to VM and JM. We do not do email activation as they will be paying with a card or PayPal and leaving. The activation email deters them and you can kiss most of those customers good bye.
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

zomby688

if still intersting , i solved this problem more simple. All this threads not solve this problem, because user still not login in joomla after registration and autologin in vm. I make authorization through joomla module only and it's  important for me. I made force logout on order_done page by adding this code in com_virtuemart\cart\order_done.php:

<?php
$currentUser 
JFactory::getUser()
if (
$currentUser->guest) {
$app JFactory::getApplication();
$app->logout();
}
?>


it's part of code from post above and you can apply it to your template and no hack need
Sry my english.

AnSit

Quote from: jenkinhill on March 22, 2013, 10:17:34 AM
I want all shoppers to be logged in to VM immediately so they can complete the purchase without being put off.

Good day to all!
Raised a very important topic!
I agree that the buyer should be able to as quickly as possible to make the order.
But equally important is the feedback from them!

After all, he created the VM so that correspond with the buyer. It is very important notice about the change of status of order. It's easy! On the phone is not an option to do so. And uncomfortable.

And as the activation time is needed in order to confirm the correct mailbox. Thus activation of the guarantee to the user.

If an order can be issued without activation and registration or wrong mailbox, then there are no guarantees. Yes and no account in Joomla that I can contact someone to do newsletters and the like. If the user makes a mistake and accidentally have the wrong mailbox it will not receive a letter of confirmation of order and therefore will not be able to get it.

The problem is not even that activation does not go well, and that it is possible to place an order without a full registration.

I beg you to make at least an option that would allow the permit or deny ordering without activation / registration!

Otherwise makes no sense option: "Only registered users can checkout"!

And many thanks to the developers for the VM and their work!

Stallion

Seriously guys of VM you should consider adding an option (checkbox in configuration) to disable vm auto login.

Activation link does not work because of session variables and it is pretty annoying....

Does anyone have a fix for this????

BrownSystems

I ended up using a combination of the hacks proposed by cavalier79 and czuryk. I believe they would both work independently just fine.

I faced a scenario in which I needed to require account activation via email before a user was able to access their account. Obviously the auto login was not acceptable because the requirement was to have users activate before accessing their account. In addition to this issue I also found that the account activation link would not work. So I had to modify the users registration model as described by cavalier79 and czuryk.

I'm not sure if this is still an issue in VM as I am using a dated and heavily hacked version of Virtuemart but it seems to me that the account activation feature wasn't created in a logical manner. I can't think of any scenario in which you would want to require account activation yet allow access to the account immediately after registration.

I initially attempted to figure out where VM is establishing the auto login but I ended up giving up and using this ugly hack. It would be nice if VM developers would provide the location of where the auto login happens or even better provide a config setting to disable this. 

anksuthar

It is solved by hack in Virtuemart file hack also working if user activate account by him-self  through email no need to core joomla file hack only hack in virtuemart

I m solve this issue in  VirtueMart 3.0.12  other version may be some different code.


in file path "components\com_virtuemart\controllers\user.php"
find function
private function saveData($cartObj) {

}


then in function
$switch = false;
            if($currentUser->guest==1 and $register){
               $userModel->setId(0);
               $superUser = vmAccess::isSuperVendor();
               if($superUser>1){
                  $data['vendorId'] = $superUser;
               }
               $switch = true;
            }
                               
Add again "$switch = false;"  for stop session
                                $switch = false;

and find
$return = $mainframe->login($credentials);
and comment them

//$return = $mainframe->login($credentials);